Roblox Python 购买物品 post 请求
Roblox Python Buy Item with post requests
我想在 python 中使用 roblox api 购买一件商品。但是,我无法找到 link 来发出 post 购买商品的请求。到目前为止,这是我的代码:
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 请求。感谢帮助!谢谢!
我推荐使用硒!
之所以这样,是因为简单多了!
使用 selenium 购买商品的示例代码:
from time import sleep as wait
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.roblox.com/catalog/139152472/Holiday-Crown") ##opens the link
wait(30) ## gives you 30 seconds to sign in before the script runs!
driver.find_element_by_class("btn-fixed-width-lg btn-growth-lg PurchaseButton").click()## clicks the element it finds with that class
driver.find_element_by_id("confirm-btn").click() ##clciks the the comfirm button
如果您需要一点帮助,这里是 meh discord:Encryptal#3233
这是我的 roblox 帐户:Encryptal
我正在学习这个,所以我可以帮助你解释它!
:D
另外如果你无聊没人玩roblox ......
我想在 python 中使用 roblox api 购买一件商品。但是,我无法找到 link 来发出 post 购买商品的请求。到目前为止,这是我的代码:
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 请求。感谢帮助!谢谢!
我推荐使用硒!
之所以这样,是因为简单多了!
使用 selenium 购买商品的示例代码:
from time import sleep as wait
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.roblox.com/catalog/139152472/Holiday-Crown") ##opens the link
wait(30) ## gives you 30 seconds to sign in before the script runs!
driver.find_element_by_class("btn-fixed-width-lg btn-growth-lg PurchaseButton").click()## clicks the element it finds with that class
driver.find_element_by_id("confirm-btn").click() ##clciks the the comfirm button
如果您需要一点帮助,这里是 meh discord:Encryptal#3233
这是我的 roblox 帐户:Encryptal
我正在学习这个,所以我可以帮助你解释它! :D