D
D
Dream2021-07-13 22:00:34
Python
Dream, 2021-07-13 22:00:34

How to fix response 401?

I want to get data from the site (true or false) through requests, namely requests.get('website link') . The response comes in the form of <[Response 401]> . I looked on the Internet, but did not understand, mostly they wrote about HTTPBasicAuth (but after looking at it, I also did not understand where to get the login and password and what they are for).

How can I get a normal response and not a 401?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-07-13
@dreameddd

If the requested page requires authentication, then the appropriate information must be passed to the request in order for the request to be authorized. Most likely this is cookie authentication, maybe Basic, and some others.
Also, the problem may be that the necessary request headers are not transmitted, the same user-agent.
See what request the browser sends and repeat it through requests.
Not clear without code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question