Answer the question
In order to leave comments, you need to log in
How to authorize in a corporate environment through a script?
I need to download several pages on the corporate website for analysis, but I can't log in. The server always responds with 401. I
use a standard request:
r = requests.get('https://example.com', auth=('user', 'pass'))
Answer the question
In order to leave comments, you need to log in
How to log in correctly?The answer to this question is known only to the one who wrote this site.
from requests.auth import HTTPBasicAuth
r = requests.post('https://example.com, auth=HTTPBasicAuth('user', 'pass'))
Watch outgoing / incoming requests with a browser, and in the script in the headers form the same ones.
For example, the User-Agent can be checked on the server side
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question