Langsung ke konten
iRoamly Shop

Kueri Kode QR (Python)

Permintaan Python lengkap untuk Kueri Kode QR, termasuk header AuthKey dan Certification. Ganti placeholder AuthKey dan AuthSecret dengan nilai dari halaman kunci API Anda.

Referensi Kode

Kueri Kode QR (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"
}
Endpoint API

Kueri Kode QR

URL Permintaan:https://api.iroamly.shop/openapi/qrcodeQuery
Metode Permintaan:POST

Parameter Permintaan:

ParameterDeskripsiTipe
redeemCodeKode penukaranString

Deskripsi Field Respons:

FieldDeskripsiTipe
redeemCodeKode penukaranString
qrcodeURL gambar kode QRString
statusStatus kode penukaran (lihat Definisi Status Kode Penukaran)Int
qrcode_contentIsi kode QR (string aktivasi LPA, mis. LPA:1$…)String
iscouldrenewalApakah eSIM dapat diperpanjang: 1 - dapat diperpanjang 0 - tidak dapat diperpanjangInt
Contoh Parameter
{
  "redeemCode": "m8hed7h2fed",
}
Contoh Respons
{
  "code": 1,
  "msg": "success",
  "redeemCode": "m8hed7h2fed",
  "qrcode": "https://dsfjigewafe/qrcode.jpg"
}
Referensi Kode

Contoh Python lainnya