Skip to content

Instantly share code, notes, and snippets.

@JeyKJey
Last active April 2, 2020 10:22
Show Gist options
  • Save JeyKJey/083c1b5e14e64b3b1ff734bb45b859be to your computer and use it in GitHub Desktop.
Save JeyKJey/083c1b5e14e64b3b1ff734bb45b859be to your computer and use it in GitHub Desktop.
# library to generate user agent
from user_agent import generate_user_agent
# generate a user agent
headers = {'User-Agent': generate_user_agent(device_type="desktop", os=('mac', 'linux'))}
#headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux i686 on x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.63 Safari/537.36'}
page_response = requests.get(page_link, timeout=5, headers=headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment