programming-examples/python/_Basics/Access and print a URL's content to the console.py
2019-11-15 12:59:38 +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)