الانتقال إلى المحتوى
iRoamly Shop

التحويل إلى رمز QR (Python)

طلب Python كامل لـ التحويل إلى رمز QR، بما في ذلك ترويستا AuthKey وCertification. استبدل قيمتي AuthKey وAuthSecret النائبتين بالقيم الموجودة في صفحة مفتاح API.

مرجع التعليمات البرمجية

التحويل إلى رمز QR (Python)

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

التحويل إلى رمز QR

(ملاحظة: تُرسَل رموز QR إلى عنوان البريد الإلكتروني المحدد بعد التحويل. قد تستغرق الدفعات الأكبر وقتًا أطول للمعالجة.)

عنوان 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",
}
مرجع التعليمات البرمجية

مزيد من أمثلة Python