QR कोड क्वेरी करें (Python)
QR कोड क्वेरी करें के लिए पूरा Python अनुरोध, AuthKey और Certification हेडर सहित। प्लेसहोल्डर AuthKey और AuthSecret को अपने API कुंजी पेज के मानों से बदलें।
कोड संदर्भ
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"
}
API एंडपॉइंट
QR कोड क्वेरी करें
अनुरोध URL:
https://api.iroamly.shop/openapi/qrcodeQueryअनुरोध मेथड:
POSTअनुरोध पैरामीटर:
पैरामीटरविवरणप्रकार
redeemCodeरिडीम कोडString
रिस्पॉन्स फ़ील्ड का विवरण:
फ़ील्डविवरणप्रकार
redeemCodeरिडीम कोडString
qrcodeQR कोड इमेज URLString
statusरिडीम कोड की स्थिति (रिडीम कोड स्थिति परिभाषाएँ देखें)Int
qrcode_contentQR कोड की सामग्री (LPA एक्टिवेशन स्ट्रिंग, जैसे, LPA:1$…)String
iscouldrenewalक्या eSIM रिन्यू किया जा सकता है:
1 - रिन्यू किया जा सकता है
0 - रिन्यू नहीं किया जा सकताInt
{
"redeemCode": "m8hed7h2fed",
}{
"code": 1,
"msg": "success",
"redeemCode": "m8hed7h2fed",
"qrcode": "https://dsfjigewafe/qrcode.jpg"
}कोड संदर्भ