Consultar QR code (Python)
Requisição Python completa para Consultar QR code, incluindo os headers AuthKey e Certification. Substitua os valores de exemplo de AuthKey e AuthSecret pelos valores da sua página de chave de API.
Referência de código
Consultar QR code (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 da API
Consultar QR code
URL da requisição:
https://api.iroamly.shop/openapi/qrcodeQueryMétodo da requisição:
POSTParâmetros da requisição:
ParâmetroDescriçãoTipo
redeemCodeCódigo de resgateString
Descrição dos campos da resposta:
CampoDescriçãoTipo
redeemCodeCódigo de resgateString
qrcodeURL da imagem do QR codeString
statusStatus do código de resgate (veja Definições de status do código de resgate)Int
qrcode_contentConteúdo do QR code (string de ativação LPA, ex.: LPA:1$…)String
iscouldrenewalSe a eSIM pode ser renovada:
1 - pode ser renovada
0 - não pode ser renovadaInt
{
"redeemCode": "m8hed7h2fed",
}{
"code": 1,
"msg": "success",
"redeemCode": "m8hed7h2fed",
"qrcode": "https://dsfjigewafe/qrcode.jpg"
}Referência de código