Last active
February 13, 2023 19:05
-
-
Save tadaoisgod/e5d91c8da80b083c64a4dafc0c2bdc0d to your computer and use it in GitHub Desktop.
How to add user agents to a request in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'https://www.whatsmyua.info/' | |
headers = { | |
'User-Agent': ( | |
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' | |
'(KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36' | |
), | |
} | |
response = requests.get(url, headers=headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment