转换为二维码(Python)
转换为二维码 的完整 Python 请求,包含 AuthKey 和 Certification 请求头。请将占位的 AuthKey 和 AuthSecret 替换为您 API 密钥页面中的值。
代码参考
转换为二维码(Python)
import requests
import json
import hashlib
# URL for the request
url = "https://api.iroamly.shop/openapi/redeemQRcode"
# 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 = {
"email": "2m827n32d@gmail.com",
"codeList": [
{
"redeemCode": "nDb4TDCn6vMhbQv",
},
{
"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,"msg":"success"}
API 接口
转换为二维码
(注:转换完成后,二维码将发送到指定邮箱。批量越大,处理时间可能越长。)
请求 URL:
https://api.iroamly.shop/openapi/redeemQRcode请求方法:
POST请求参数:
参数说明类型
email邮箱String
codeList兑换码集合Object[]
productList 字段:
字段说明类型
redeemCode兑换码String
{
"email": "2m827n32d@gmail.com",
"codeList": [
{
"redeemCode": "m8hed7h2fed",
},
{
"redeemCode": "cn88beg9edj",
}
]
}{
"code": 1,
"msg": "success",
}代码参考