Skip to content

Instantly share code, notes, and snippets.

@pysoftware
Last active February 14, 2019 18:02
Show Gist options
  • Save pysoftware/e70278f29d65883a1bd58108a34de627 to your computer and use it in GitHub Desktop.
Save pysoftware/e70278f29d65883a1bd58108a34de627 to your computer and use it in GitHub Desktop.
Fake user agent
from fake_useragent import UserAgent
def get_html(url):
response = requests.get(url, headers={'User-Agent': UserAgent().chrome})
return response.text
# Результат UserAgent().chrome:
# 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment