本文へスキップ
iRoamly Shop

QR コードの照会(Python)

QR コードの照会 に対する Python の完全なリクエスト例です。AuthKey と Certification ヘッダーも含みます。プレースホルダーの AuthKey と AuthSecret は、API キーのページの値に置き換えてください。

コードリファレンス

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"
}
API エンドポイント

QR コードの照会

リクエスト URL:https://api.iroamly.shop/openapi/qrcodeQuery
リクエストメソッド:POST

リクエストパラメーター:

パラメーター説明型
redeemCode引き換えコードString

レスポンスフィールドの説明:

フィールド説明型
redeemCode引き換えコードString
qrcodeQR コード画像の URLString
status引き換えコードのステータス(引き換えコードのステータス定義を参照)Int
qrcode_contentQR コードの内容(LPA アクティベーション文字列、例: LPA:1$…)String
iscouldrenewaleSIM を更新できるかどうか: 1 - 更新可能 0 - 更新不可Int
パラメーター例
{
  "redeemCode": "m8hed7h2fed",
}
レスポンス例
{
  "code": 1,
  "msg": "success",
  "redeemCode": "m8hed7h2fed",
  "qrcode": "https://dsfjigewafe/qrcode.jpg"
}
コードリファレンス

その他の Python 例