带有后期处理请求的Roblox Python购买项目

问题描述 投票:0回答:1

我正在尝试使用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个错误,错误代码为{“错误”:[{“代码”:400,“消息”:“ BadRequest”}]}我只需要找出正确的网址即可将发布请求发送至。感谢帮助!谢谢!

python cookies python-requests roblox
1个回答
0
投票

我建议使用硒!

之所以这样,是因为它要简单得多!

购买含硒商品的示例代码:

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

[如果您需要一点帮助,请与我联系:Encryptal#3233

这里是我的roblox帐户:加密

我正在学习此方法,以便我可以帮助您并进行解释!:D

如果您很无聊又没有人玩roblox .........

© www.soinside.com 2019 - 2024. All rights reserved.