QR-Code abfragen (Python)
Vollständige Python-Anfrage für QR-Code abfragen, einschließlich der Header AuthKey und Certification. Ersetzen Sie die Platzhalter für AuthKey und AuthSecret durch die Werte von Ihrer API-Schlüssel-Seite.
Code-Referenz
QR-Code abfragen (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"
}
API-Endpunkte
QR-Code abfragen
Anfrage-URL:
https://api.iroamly.shop/openapi/qrcodeQueryAnfragemethode:
POSTAnfrageparameter:
ParameterBeschreibungTyp
redeemCodeEinlösecodeString
Beschreibung der Antwortfelder:
FeldBeschreibungTyp
redeemCodeEinlösecodeString
qrcodeURL des QR-Code-BildsString
statusStatus des Einlösecodes (siehe Definitionen der Einlösecode-Status)Int
qrcode_contentInhalt des QR-Codes (LPA-Aktivierungsstring, z. B. LPA:1$…)String
iscouldrenewalOb die eSIM verlängert werden kann:
1 - kann verlängert werden
0 - kann nicht verlängert werdenInt
{
"redeemCode": "m8hed7h2fed",
}{
"code": 1,
"msg": "success",
"redeemCode": "m8hed7h2fed",
"qrcode": "https://dsfjigewafe/qrcode.jpg"
}Code-Referenz