【问题标题】:Roblox Python Buy Item with post requests带有发布请求的 Roblox Python 购买项目
【发布时间】: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


    【解决方案1】:

    我推荐使用硒!

    这样做的原因是因为它要简单得多!

    使用硒购买商品的示例代码:

    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 ......

    【讨论】:

    • 我在 discord 上加了你。我只是有一些问题
    猜你喜欢
    • 2021-04-17
    • 1970-01-01
    • 2020-06-26
    • 2020-08-09
    • 1970-01-01
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多