Skip to content

Instantly share code, notes, and snippets.

@AnderRV
Created August 11, 2021 15:12
Show Gist options
  • Save AnderRV/6e87b0289959b5c321ae24b9a3bdf575 to your computer and use it in GitHub Desktop.
Save AnderRV/6e87b0289959b5c321ae24b9a3bdf575 to your computer and use it in GitHub Desktop.
proxies = {
'http': 'http://190.64.18.177:80',
'https': 'http://49.12.2.178:3128',
}
headers = {
'authority': 'httpbin.org',
'cache-control': 'max-age=0',
'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
'sec-ch-ua-mobile': '?0',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'sec-fetch-site': 'none',
'sec-fetch-mode': 'navigate',
'sec-fetch-user': '?1',
'sec-fetch-dest': 'document',
'accept-language': 'en-US,en;q=0.9',
}
def get_html(url):
try:
response = requests.get(url, headers=headers, proxies=proxies)
return response.content
except Exception as e:
print(e)
return ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment