Tracing sent post request body and comparing it with one made by requests
lib
#5292
-
So, i'm currently working on own auth module for Steam, it requires me to send a post request with Dictionary with original data, everything here is either data = {
'username': username,
"password": b64encode(pkcs1v15_encrypt(self.key, password.encode('ascii'))),
"emailauth": email_code,
"emailsteamid": '76561198160729942' if email_code else ' ',
"twofactorcode": twofactor_code,
"captchagid": str(self.captcha_gid),
"captcha_text": captcha,
"loginfriendlyname": "async-steam webauth",
"rsatimestamp": self.timestamp,
"remember_login": 'true',
"donotcache": str(int(time() * 100000))
} Here's the pretty-printed version of what's inside it (with some data being cut, since it's login credentials lol): {'captcha_text': '',
'captchagid': '-1',
'donotcache': '160641367300963',
'emailauth': 'DGP4X',
'emailsteamid': '76562298160729942',
'loginfriendlyname': 'async-steam webauth',
'password': b'Twe/NBCK7GSHqob4qUuWZdsVrgt6Lh746GJWa17gwsnAFO8CJ3UP7nT80jpOkJiT'
b'zkfJiLKg/HZcpnfx0InIXg==',
'remember_login': 'true',
'rsatimestamp': '151278700000',
'twofactorcode': '',
'username': 'NNN'} I'm sending the data with following call, immediately after defining that data: resp = await self.session.post(f'https://steamcommunity.com/login/dologin/', data=data, timeout=15) Session object here is a But the response i'm getting from Steam contains only I've tried to do the same via resp = requests.post('https://steamcommunity.com/login/dologin/', data=data, timeout=15) I've replace aiohttp call with requests call directly, data is exactly the same, and it does trigger two-factor / email login confirmation etc. So here's my question - can i somehow compare the encoded bodies of sent data and understand what's going wrong? The purpose of the module is to utilize asyncio, so using synchronous requests is not an option (at least until i give up on fixing it). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
UPDATE: So, i tried requesting my local server with same data, and turns out that |
Beta Was this translation helpful? Give feedback.
UPDATE:
So, i tried requesting my local server with same data, and turns out that
password
field in getting sent as afile stream
inaiohttp
, whilerequests
is sending them asbytes
(as they should be). Is there a way to omit this behavior? I've tried adding content-type ofapplication/octet-stream
which were suggested on Mulitpart wiki page, but that haven't change anything