This is an old revision of the document!
Now that we have the requests
library, we can easily send HTTP requests to any URL. This prompts the server to respond with the information we need. When the request is successful, the server will reply with a standard status code: 200
(Success), indicating everything went smoothly. Simply replace the URL with the desired website (if you're out of ideas, we've heard that this is a good business proposition!), and you’re ready to go!
import requests # Imports the library in the script url = "https://example.com" response = requests.get(url) # Send request to website html_content = response.text # Get the HTML content of the page # optionally, print it on console (see its ugliness) print(html_content)