Consultar código QR (Python)
Solicitud completa en Python para Consultar código QR, con los headers AuthKey y Certification. Sustituye los valores de ejemplo de AuthKey y AuthSecret por los de tu página de clave de API.
Referencia de código
Consultar código QR (Python)
import requests
import json
import hashlib
# URL for the request
url = "https://api.iroamly.shop/openapi/qrcodeQuery"
# Provided AuthKey and AuthSecret, remember to replace them with real values
auth_key = "YOUR_AUTH_KEY_HERE"
auth_secret = "YOUR_AUTH_SECRET_HERE"
# Calculating Certification
combined = auth_key + auth_secret
certification = hashlib.sha256(combined.encode()).hexdigest()
# Header parameters for the request
headers = {
"Content-Type": "application/json",
"AuthKey": auth_key,
"Certification": certification
}
# Example data for the request body
data = {
"redeemCode":"XRdDeSxBVNbvCpU"
}
# Sending POST request
response = requests.post(url, headers=headers, data=json.dumps(data))
# Printing the response content
print(response.text)
# Example of response
{
"code":1,
"qrcode":"https:/code.tokyoesim.com/20231220/1703048857317.65625d0a779f4598d55d77bda43ecd80.png",
"msg":"success",
"redeemCode":"XRdDeSxBVNbvCpU"
}
Endpoints de la API
Consultar código QR
URL de la solicitud:
https://api.iroamly.shop/openapi/qrcodeQueryMétodo de la solicitud:
POSTParámetros de la solicitud:
ParámetroDescripciónTipo
redeemCodeCódigo de canjeString
Descripción de los campos de la respuesta:
CampoDescripciónTipo
redeemCodeCódigo de canjeString
qrcodeURL de la imagen del código QRString
statusEstado del código de canje (consulta Definiciones de estados del código de canje)Int
qrcode_contentContenido del código QR (cadena de activación LPA, p. ej., LPA:1$…)String
iscouldrenewalIndica si la eSIM se puede renovar:
1 - se puede renovar
0 - no se puede renovarInt
{
"redeemCode": "m8hed7h2fed",
}{
"code": 1,
"msg": "success",
"redeemCode": "m8hed7h2fed",
"qrcode": "https://dsfjigewafe/qrcode.jpg"
}Referencia de código