【发布时间】:2020-06-22 23:33:29
【问题描述】:
我正在尝试使用 Python 中的 roblox api 购买商品。但是,我无法找到发出购买商品的发布请求的链接。到目前为止,这是我的代码:
def buyItem(self,itemid, cookie):
info = self.getItemInfo(itemid)
url="https://api.roblox.com/item.ashx?rqtype=purchase&productID={}&expectedCurrency=1&expectedPrice={}&expectedSellerID={}&userAssetID=".format(info["ProductId"], 0 if info["PriceInRobux"] == None else info["PriceInRobux"],info["Creator"]["Id"])
print(url)
cookies = {
'.ROBLOSECURITY': cookie
}
headers = {
'X-CSRF-TOKEN': self.setXsrfToken(cookie)
}
r = self.s.post(url, cookies=cookies, headers=headers)
print(r.status_code)
return r
我收到 400 个错误,错误代码是 {"errors":[{"code":400,"message":"BadRequest"}]} 我只需要找出正确的 url 来发送 post 请求。帮助表示赞赏!谢谢!
【问题讨论】:
标签: python cookies python-requests roblox