futapi / fut

fut is a simple library for managing Fifa 19 Ultimate Team.
GNU General Public License v3.0
316 stars 138 forks source link

500 error bid #181

Closed rishb closed 7 years ago

rishb commented 8 years ago

I was tweaking the code slightly on my own fork of this library, but I seem to run into issues with bidding. Every time I bid, it doesn't reflect and instead returns the following json response:

{u'debug': u'', u'reason': u'', u'code': u'500', u'string': u''}

The status code of the response, however, is 200. Also, I'm not temp banned because I can make the bid successfully through the web app. I'm not sure what I'm doing wrong. Here is the relevant code for the bid:

bid_url = 'https://utas.s3.fut.ea.com/ut/game/fifa16/trade/{0}/bid'.format(listing["tradeId"]) bid_data = {'bid': bid_amount} search.ea_req.headers['X-HTTP-Method-Override'] = "PUT" search.ea_resp = search.ea_req.post(bid_url, data=json.dumps(bid_data))

oczkers commented 8 years ago

This code looks fine for me, have You tried sniffing request and comparing to original one?

rishb commented 8 years ago

Yeah, it is the same.

oczkers commented 8 years ago

Are you abble to make any other requests when bidding fails (sessiong might be expired for example)?

rishb commented 8 years ago

Yeah, I can search the auction market etc.

rishb commented 8 years ago

These are my headers:

{'Origin': 'https://www.easports.com', 'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip,deflate,sdch', 'X-UT-PHISHING-TOKEN': u'[censored by oczkers]', 'Accept': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36', 'DNT': '1', 'Connection': 'keep-alive', 'Referer': 'https://www.easports.com/iframe/fut16/bundles/futweb/web/flash/FifaUltimateTeam.swf', 'X-UT-SID': u'[censored by oczkers]', 'X-HTTP-Method-Override': 'PUT', 'X-Requested-With': 'ShockwaveFlash/19.0.0.226', 'X-UT-Embed-Error': 'true', 'Content-Type': 'application/x-www-form-urlencoded'}

rishb commented 8 years ago

I don't think the headers are wrong, though the sniffer does not show a "Referrer". Maybe I'm forgetting to put the item into a trade pile or something? I just do a search, find the trade id of the item I want then try to bid on the item with the code above.

oczkers commented 8 years ago

I don't think original fut is setting referer before making bid so this shouldn't be an issue, especially when other requests are working.

'Content-Type' in original header is set to 'application/json' or 'application/x-www-form-urlencoded' ?

rishb commented 8 years ago

You mean what is 'Content-Type' if I sniff Firefox web app using Firebug?

oczkers commented 8 years ago

Browser declares what type of data is sending (part of headers). Looks like fut is setting it to 'application/json' and You've got 'application/x-www-form-urlencoded' but it might be changed automatically by requests library.

rishb commented 8 years ago

That was the issue. Thanks a lot.