Search code examples
pythonserverwebserver

Can a web server detect a login from a script?


This might be a silly question. When use sessions with Python to request a file from a website behind a login, can the website detect that you are logging in via a script? How common is it for websites to detect this? I tried looking this up but couldn't find an answer so if this is a repeat question could you point me to some info so I can find my answer?

Thanks in advance!


Solution

  • You should change the user agent. But other than that I don’t think its detectable.

    You can change the user agent by setting a custom header e.g. requests.get(url, headers= {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"}