Answer the question
In order to leave comments, you need to log in
How to solve the problem with requests response encoding?
Good evening everyone, I apologize in advance to everyone for the clumsy formulation of the question.
When trying to transfer the script to the server, a problem arose, the responses after the get () request began to come encrypted.
the code:
import json
import requests
from config import Login, Password
ssn = requests.Session()
with open("./requests.json", 'r', encoding='utf-8') as file:
block = json.load(file)['kit_1']
block['data']['uLogin'] = Login
block['data']['uPassword'] = Password
response = ssn.post(block['url'], data=block['data'], headers=block['headers'], verify=False)
print(response.content)
with open('./requests.json', 'r', encoding='utf-8') as file:
block = json.load(file)['kit_2']
block['headers']['Cookie'] += str(ssn.cookies['SESSION'])
print(ssn.post(block['url'], headers=block['headers']).content)
"kit_1": {
"url": "https://melbet.ru/user/auth/",
"data": {
"uLogin": "",
"uPassword": "",
"save": ""
},
"headers": {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3",
"Connection": "keep-alive",
"Content-Length": "32",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Host": "melbet.ru",
"Origin": "https://melbet.ru",
"Referer": "https://melbet.ru/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
"X-Requested-With": "XMLHttpRequest"
}
},
"kit_2": {
"url": "https://melbet.ru/user/balance/",
"data": "",
"headers": {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Length": "0",
"Content-Type": "application/json",
"Cookie": "SESSION=",
"Host": "melbet.ru",
"Origin": "https://melbet.ru",
"Pragma": "no-cache",
"Referer": "https://melbet.ru",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
"X-Requested-With": "XMLHttpRequest"
}
}
b'{"balance":[{"id":---,"money":52.8,"lineRestrict":"0","liveRestrict":"0","BetVivaroBalance":0,"fantasy_virt_balance":0,"idCurrecy":1,"kode":"RUB","HasPromoStavka":1,"firstdep":null,"firstdepbonus":null,"hasbonus":0,"refID":195,"PointsBalance":0,"idException":105497,"TypeAccount":0,"line_type":0,"need_ban":0,"Bonus":0,"typ":0,"alias":"","MinOutDeposite":30,"MinOutElectronDeposite":100,"MinInElectronDeposite":50,"freespins":null,"AccountName":""},{"id":,"money":100,"lineRestrict":"0","liveRestrict":"0","BetVivaroBalance":0,"fantasy_virt_balance":0,"idCurrecy":1,"kode":"RUB","HasPromoStavka":0,"firstdep":null,"firstdepbonus":null,"hasbonus":1,"refID":195,"PointsBalance":0,"idException":,"TypeAccount":1,"line_type":0,"need_ban":0,"Bonus":1,"typ":4,"alias":"","MinOutDeposite":30,"MinOutElectronDeposite":100,"MinInElectronDeposite":50,"freespins":null,"AccountName":""}],"bonus":[{"id":,"idBonus":1637,"BonusName":"","TypeBonus":6,"bonus_start":100,"WinningBack":25,"WinningBackConditions":3,"cnt":0,"ssm":0,"bonus_fact":0,"bonus_finish":25,"BonusClosed":0,"errIDForTranslate":157836,"dt":1635754252,"HasCansel":1,"casino":0,"money":100,"closing_time":1635754252,"currency_code":"RUB","Trslt_BonusName":""}],"success":true}'
b'\x03\xbe\x02\x00\x80\xaa\xaa\xaa\xea\xfftu\x90\xb3B\x82\x99\x9b\x9b\x99\xbb\xde\xd2="!\xe3\x90\x99\x01\x91\x91\x99\x87\x80\x04\x03u5\xf1\x08\x81P\x175PQsH\x83\x80\x00\x88\xc8\[email protected]\x1e\xf2\x9a\x87<\x9c##3 3\x12 "\x0fW5\xbf\xf7\xc4\xbb\\\xd3\xa9f{oeH^\xf6>\x06\x0f\x8b\xc1\xc3\xe3\xc9T\x8b\xc1b\xb0\x80\x03\xd0\xba\xa9\xc8q7\xd8\xb8P\xff\xf9\x02\xd6\xc6\x19\xb6\x08\xfa\xe4\x02\xa8\x05=\xad\xaa\xaa\xac\xca\xbaP\xb0\xf5\x8c\x03\xe8b\xfad\xae\xc0\x11\xe3\x11J\x0cd#h\[email protected]\x81\xa3\x1d\x1e\xa1\[email protected]\x82\x86\x0c\x14,1\xbe\xa5\x9d\t~i\\\xcb0S\xb01\x1c\x8d\x0c\xcd\x8eBlb\xc6k3\x05\xd4\xae\xfa\x10\xd0\x0e\xa0s\x05\xe7\xbeE\xd0p\xf4f\t\n\x9e\x1b9\x0c~\xeb_G\xb3;7\xf0\x87\x06\x1b\n\x12[\[email protected]\xef\x1c\xb7\xf6\xb5\xe7^\x0c\x8b\x9e\x19\xe1\xe4\\\xa6 \xe0\xe6`\x0ft\xbe(\x15\x1cz\xe2(\xa9%\xd3\xd4\xee\x7f\xb0\xd8E\xf2\x0c:\xcf\xca\xd9\xa2Vp<t\xf8\xd4Z\xdfst\xc3\xde\x11c\x13\x87\x0e\x19v\x8c\xd86k\xc3\x04c\x19;\x98LA\x1c\xba7\xcf\[email protected]\x03(xA\xfc\xaa\x8f{\xd8y\xa1\x88\xa0\x8b\x8c_\xdc\xbeC\x1b\x83g\xfb\xda\xf2\xecCh\x07l\x7f\x89\xb2\x87d\x03\xa2t\xc4\x85\xc6\x9a\xa4\xbe4\xdb\xa6\xd1A\xfa1^\xa7\x87\xf4\x98n_\xbc\xdf\xc3\xa5\x923\xf8bV\xce\xebE]-\x10K\xb4\\\xd67\xe9n\xa3f.\n\xa4\xe6V\xc8\xb1\xa1\x96Y\x81g\xe4x\x139\x043\xdc\x11\xf6[zL\x0f\xe3\'M\xc9\x8f_\xd2=\\\xbeW0\xd2\x82\x13]\x83\xcf\xe7U5\xab\xe7\xf5b\x86\xa9N\xe1\x9eWE=\x92\xf2\x19\x8b\xf9\xef\xe9n\xfc\x9c~\x8e_\xd3\xbfI\xfa\x93n&\xe9\xffx\x95\x1e\xd3\xdf\xf4k\xbcJ7\xe9!\x08\x9f\xb9\x9b\x8c\xd7\xe3U\xbaK\xbf\xc7\xeb\xf1c\xbaM7\xd0\xbbP\x9d\xa3\[email protected]#\xd1\x848B2zG\xcc\xc4\xa7Kc\xcfAOK2\xed+\xcf--\x15Y\x01](\xb0\x8b$*\xb2\xd5\x9eK9\xdal\xcc\xc9 dT\xec\xc4$g\xeeB\x89mV\xce\x0b\xb6\xbfx\x84!\x1c\xec=\xf3\xe18\x18\x16g\x96\x89|^\xd6\xf3\xa2R\xd0\xe6D\xbe*\xca\xba\x9cM\xcb\xe9\xd1`\xb32,\xe8\xb4dc\x8d\x10{?\xac[\xcf\x97\x8c\xca\xf8\x1fX\xe7\x85\xf8\xb4\x89\xb4=\x84\xdc\xc5\x03\xf6\x18Qg;4\xf6\x12%\xe68\x88\x8bMf\xfc\xdb\xeef=\x07\xd2[\x8b"\xa0c\xe8\xf1r'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question