Question

I need to make GET requests with Python using the requests library, but my User Agent string shows up as python-requests/2.27.1. How can I change it to look more like a browser.

Answer

import requests

user_agent = "Firefox whatever"
headers = {"User-Agent": user_agent}

requests.get("http://example.com/", headers = headers)