我目前正试图编写代码,以找出对Minecraft迁移帐户的认证发生了什么变化,这是我的代码。
import requests
from uuid import uuid4
uuid = uuid4().hex #used as client token
payload = {
"agent": {
"name": "Minecraft",
"version": 1
},
"username": "AGmailAccount@gmail.com",
"password": "APasswordToTheAccount",
"clientToken": uuid,
"requestUser": True
}
print(requests.post("https://authserver.mojang.com/authenticate", headers = {"content-type":"application/json"}, data = payload))
每次我运行它,我得到一个400错误代码,我应该得到一个适当的,非200 HTTP状态码或json编码的字典。
my resources are
<https://wiki.vg/Mojang_API> ,
<https://wiki.vg/Authentication> ,
and the mojangapi library <https://pypi.org/project/mojang-api/>
试试下面这行:
print(requests.post("https://authserver.mojang.com/authenticate", json=payload))
你发送JSON的方式不对。