跳到正文
iRoamly Shop

查询二维码(Python)

查询二维码 的完整 Python 请求,包含 AuthKey 和 Certification 请求头。请将占位的 AuthKey 和 AuthSecret 替换为您 API 密钥页面中的值。

代码参考

查询二维码(Python)

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 接口

查询二维码

请求 URL:https://api.iroamly.shop/openapi/qrcodeQuery
请求方法:POST

请求参数:

参数说明类型
redeemCode兑换码String

响应字段说明:

字段说明类型
redeemCode兑换码String
qrcode二维码图片 URLString
status兑换码状态(见“兑换码状态定义”)Int
qrcode_content二维码内容(LPA 激活字符串,例如 LPA:1$…)String
iscouldrenewaleSIM 是否可续费: 1 - 可续费 0 - 不可续费Int
示例参数
{
  "redeemCode": "m8hed7h2fed",
}
返回示例
{
  "code": 1,
  "msg": "success",
  "redeemCode": "m8hed7h2fed",
  "qrcode": "https://dsfjigewafe/qrcode.jpg"
}
代码参考

更多 Python 示例