Python Web Crawling Login Question!

Asked 1 years ago, Updated 1 years ago, 126 views

import requests from bs4 import BeautifulSoup

s = requests.Session() req = s.get('http://www.filesun.com/')

LOGIN_INFO = { 'user_id': ' ', 'password': ' ' }

with requests.Session() as s:

login_req = s.post('http://www.filesun.com/', data=LOGIN_INFO)

print(login_req.status_code)

Now we want to run the code this way.

However, the error always shows 200 no matter what password or ID you enter.

As far as I know, 404 is an error code and it means 200 but it appears to be 200

I'd like to make a clear login code, so could you give me a hint?

web-crawling login python

2022-09-22 13:38

1 Answers

404 is not an error, it means that the URL does not exist.

200 means successful with OK, which means normal. This means that the call is normal, not normal in logic.

That is, HTTP gives 200 even if authentication fails. The call itself is normal.

Success should not be viewed as an HTTP response, but should be checked by parsing the body or by the return string of the body.


2022-09-22 13:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.