You can use the urllib
module in python to make HTTP GET requests. Here is an example:
main.py118 chars6 lines
In the above example, we first import the urllib.request
module. Then, we make a GET request to the URL https://www.google.com
using the urlopen()
method. This method returns a response object, which we can read using the read()
method. Finally, we print the HTML of the page.
Note that you can also pass additional parameters to the urlopen()
method, such as headers or data for a post request.
gistlibby LogSnag