Created
March 28, 2022 12:58
-
-
Save InputBlackBoxOutput/ac3657bb99ea6574be965eb7ae4b3a97 to your computer and use it in GitHub Desktop.
Get the HTML source code for a webpage
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
import requests | |
headers = { | |
'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" | |
} | |
def get_webpage(): | |
url = "www.google.com" | |
print(url) | |
response = requests.request("GET", url, headers=headers) | |
print(response.text) | |
get_webpage() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment