pip install fake_useragent
import requests from fake_useragent import UserAgent ua = UserAgent() headers = {'User-Agent': ua.random} requests.get(url, headers=headers)