Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 911 forks source link

TradeSession.GetForeignInventory() no longer seems to be working #560

Closed johnblaise closed 9 years ago

johnblaise commented 10 years ago

This morning I noticed in my bot that TradeSession.GetForiegnInventory() no longer seems to be working. The return sting is false and contains the message "missing parameter". Does it now need additional parameters?

debugger-perm commented 10 years ago

Yep. Steam want uri with param's. like http://steamcommunity.com/trade/STEAMIDTHERE/foreigninventory/?sessionid=BLABLABLA&steamid=STEAMIDTHERE&appid=440&contextid=2 . I don't know what param it need, i rebild uri in SteamWeb Request() method like this sample.

2014-03-27 13:35 GMT+06:00 johnblaise notifications@github.com:

This morning I noticed in my bot that TradeSession.GetForiegnInventory() no longer seems to be working. The return sting is false and contains the message "missing parameter". Does it now need additional parameters?

Reply to this email directly or view it on GitHubhttps://github.com/Jessecar96/SteamBot/issues/560 .

johnblaise commented 10 years ago

It was working for the 3 months, the problem occurred only from yesterday. I checked the code and it is correctly sending the 4 variables that you mentioned but still it is giving an error of missing parameter

StormReaper commented 10 years ago

The format has changed it's no longer a POST request, instead it's a GET with all the variables inside the request url, shouldn't be hard to fix. I can do a pull in the evening if noone's submitted one by then.

johnblaise commented 10 years ago

Thanks for the clarification, After checking with Fiddler it does seem Steam client does a GET request instead of a POST. Looks like we have to change POST to GET in GetForiegnInventory(). Thanks a lot

johnblaise commented 10 years ago

Another issue is that now Steam seems to have set up some sort of paging while getting the inventory. Only the first 2500 items are returned. If inventory contains more than 2500 items we will need to set up some kind of loop to fetch the rest of the items. Of course right now this is not applicable for TF2 items as the TF2 backpack is limited to 2050. However this can affect bots accepting trading cards, csgo or other items

vudung45 commented 10 years ago

I think it just happens couple hours ago... Not sure about that...

vudung45 commented 10 years ago

Tks StormHarper for showing the problem :dancers:

I'm not showing or anything, i'm not good either. Some of you who might not know how to fix this, use my new GetForeignInventory() that has already changed the method to GET

File: TradeSession.cs

internal dynamic GetForiegnInventory(SteamID otherId, int contextId) { var data = new NameValueCollection();

        data.Add("sessionid", sessionIdEsc);
        data.Add("steamid", otherId.ConvertToUInt64().ToString());
        data.Add("appid", appIdValue);
        data.Add("contextid", contextId.ToString());
        string url = "http://steamcommunity.com/trade/" + otherId.ConvertToUInt64().ToString() + "/foreigninventory/?sessionid=" + sessionIdEsc + "&steamid=" + otherId.ConvertToUInt64().ToString() +"&appid="+ appIdValue + "&contextid=" + contextId.ToString();

        try
        {
           // string response = Fetch(baseTradeURL + "foreigninventory", "GET", data);
            string response = Fetch(url, "GET", null);
            return JsonConvert.DeserializeObject(response);
        }
        catch (Exception)
        {
            return JsonConvert.DeserializeObject("{\"success\":\"false\"}");
        }
    }
vudung45 commented 10 years ago

I'm not sure what is happening but OnTradeComplete() or OntradeSuccess() seem not to work anymore..

Did steam just only change the tradeweb from get to post?

@StormReaper: Did they change all the things to GET?

StormReaper commented 10 years ago

@vudung45 I don't think there were any other changes.

BlueRaja commented 10 years ago

@johnblaise The fix has been merged, can this now be closed?