Last active
February 14, 2019 18:02
-
-
Save pysoftware/e70278f29d65883a1bd58108a34de627 to your computer and use it in GitHub Desktop.
Fake user agent
This file contains hidden or 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
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