search

Home  >  Q&A  >  body text

python - How to determine if the crawler has logged in successfully?

Read this tutorial: https://github.com/xchaoinfo/fuck-login/blob/master/015 CSDN/csdn.py, this is the code to simulate logging into csdn, using response.status_code (the above link code (line 63) is equal to 200 to determine whether the login is successful, but this is not the case. I tried to enter the wrong password, and the status_code is still equal to 200. I looked online and said that status_code==200 means that the server successfully accepted the client. ask.

So what should we do to determine whether the login is successful?

PHPzPHPz2777 days ago1368

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-05-18 10:54:58

    Go and grab a page that can only be seen after logging in. If you successfully logged in, then the content you grabbed is correct, otherwise the content should be asking you to log in or something

    reply
    0
  • Cancelreply