You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
426 B

from urllib import request
response = request.urlopen('http://www.python.org')
print('RESPONSE:', response)
print('CODIGO HTTP: ', response.getcode())
print('URL :', response.geturl())
headers = response.info()
print('DATE :', headers['date'])
print('HEADERS :')
print('---------')
print(headers)
print('BODY :')
print('---------')
for _ in range (20):
linea = response.readline().decode('utf-8')
print(linea)

Powered by Informatica FP.