Nuck Posted August 23, 2021 Share Posted August 23, 2021 Hi guys, first of all i am sorry about my english. I try some trade offer accept without any library like "communitylink/tradeoffer/<tradeofferid/accept" but response either null or nothing please help me. There is my code def test(trade_id: int): with requests.Session() as s: s.get(url="https://steamcommunity.com/tradeoffer/"+trade_id+"/accept/") sessionid = s.cookies.get("sessionid") param = { "sessionid": sessionid, "serverid": 1, "tradeofferid": trade_id } headers = { "referer": "https://steamcommunity.com/tradeoffer/"+trade_id+"/" } print (sessionid) response = requests.post("https://steamcommunity.com/tradeoffer/"+trade_id+"/accept",headers=headers,params=param) print (response.text) test("4765101895") Link to comment Share on other sites More sharing options...
AD⚡HD Posted August 24, 2021 Share Posted August 24, 2021 Idk about y’all but I’ve never had to write code to accept a trade offer Link to comment Share on other sites More sharing options...
Abstract Posted August 24, 2021 Share Posted August 24, 2021 5 hours ago, Nuck said: Hi guys, first of all i am sorry about my english. I try some trade offer accept without any library like "communitylink/tradeoffer/<tradeofferid/accept" but response either null or nothing please help me. There is my code def test(trade_id: int): with requests.Session() as s: s.get(url="https://steamcommunity.com/tradeoffer/"+trade_id+"/accept/") sessionid = s.cookies.get("sessionid") param = { "sessionid": sessionid, "serverid": 1, "tradeofferid": trade_id } headers = { "referer": "https://steamcommunity.com/tradeoffer/"+trade_id+"/" } print (sessionid) response = requests.post("https://steamcommunity.com/tradeoffer/"+trade_id+"/accept",headers=headers,params=param) print (response.text) test("4765101895") Is that the complete code? If that's the case, you'll need more than just that to accept trades. Link to comment Share on other sites More sharing options...
FP jh34ghu43gu Posted August 24, 2021 Share Posted August 24, 2021 Not a fan of python, when in doubt yoink other's code https://github.com/bukson/steampy Looks like you need a partner param and maybe a different header. Link to comment Share on other sites More sharing options...
D.Alex Posted August 24, 2021 Share Posted August 24, 2021 Receive any offer in your browser (Google Chrome in my case) and then on the page /tradeoffer/###/ open JavaScript console, switch to Network tab, check "Preserve log" checkmark. Click "Accept trade" and then look for "accept" POST request in the console. This way you would see that you do need a partner parameter. Link to comment Share on other sites More sharing options...
Nuck Posted August 24, 2021 Author Share Posted August 24, 2021 6 hours ago, D.Alex said: Receive any offer in your browser (Google Chrome in my case) and then on the page /tradeoffer/###/ open JavaScript console, switch to Network tab, check "Preserve log" checkmark. Click "Accept trade" and then look for "accept" POST request in the console. This way you would see that you do need a partner parameter. I still get null response final code Link to comment Share on other sites More sharing options...
Zeus_Junior Posted August 24, 2021 Share Posted August 24, 2021 8 hours ago, FP jh34ghu43gu said: Not a fan of python, when in doubt yoink other's code https://github.com/bukson/steampy Looks like you need a partner param and maybe a different header. Superior Link to comment Share on other sites More sharing options...
Nuck Posted August 24, 2021 Author Share Posted August 24, 2021 1 hour ago, Zeus_Junior said: Superior I yoink him code but still same result Link to comment Share on other sites More sharing options...
Vortegan Posted August 24, 2021 Share Posted August 24, 2021 It looks like all your code is fine, but your request isn't sending any cookies in the headers, thus steam cannot authorise you. You had the right idea with using sessions. Link to comment Share on other sites More sharing options...
Nuck Posted August 24, 2021 Author Share Posted August 24, 2021 40 minutes ago, Vortegan said: It looks like all your code is fine, but your request isn't sending any cookies in the headers, thus steam cannot authorise you. You had the right idea with using sessions. I try sending cookies like this and again same result how is that not working? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.