当我收到来自discord服务器的请求时,它会发送回这样的内容:
{"message": "Unknown Gift Code", "code": 10038}
下面是我的代码:
import requests
code = str(input("Enter a code: "))
result = requests.get('https://discord.com/api/v8/entitlements/gift-codes/' + str(code) + '?with_application=true&with_subscription_plan=true')
print(result)
当我运行它时,终端给了我
哦,我可以自己去拿。我只是使用JSON库,这样做:
import requests
import json
code = str(input("Enter a code: "))
result = requests.get('https://discord.com/api/v8/entitlements/gift-codes/' + str(code) + '?with_application=true&with_subscription_plan=true')
f_result = json.loads(result.text)
print(f_result)