programming-examples/python/Basics/Access and print a URL's content to the console.py
2019-11-18 14:44:36 +01:00

7 lines
227 B
Python

from http.client import HTTPConnection
conn = HTTPConnection("example.com")
conn.request("GET", "/")
result = conn.getresponse()
# retrieves the entire contents.
contents = result.read()
print(contents)