M
M
Mikhail2017-09-09 20:00:08
Python
Mikhail, 2017-09-09 20:00:08

Python. Requests how to fix authorization problem?

I send a Post request with a username and password (and a couple more parameters), look at the result of the request, and there it says - "{"result":"0","error":"Your browser must support cookies."}"
Googled but did not find

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2017-09-09
@LazyTalent

session = requests.Session()
r = session.post(blah, blah, blah)

S
SolidMinus, 2017-09-09
@SolidMinus

Add the User-agent of one of the browsers to the header. It helped me. Very often, such a definition works stupidly according to which browser the user has.

sess = requests.Session()
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0"}
response = sess.post(url, ..., headers=headers)

D
Dimonchik, 2017-09-09
@dimonchik2013

pycurl
or if you really want
https://stackoverflow.com/questions/7164679/how-to...
https://stackoverflow.com/questions/6878418/puttin...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question