import urllib.request
import urllib.parse
params = urllib.parse.urlencode({'cid': 1, 'did': 2})
url = "http://108.61.221.173/match_info.php?%s" % params
with urllib.request.urlopen(url) as f:
print(f.read().decode('utf-8'))
//////////////////////
reading only
from urllib.request import urlopen
with urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') as response:
for line in response:
line = line.decode('utf-8') # Decoding the binary data to text.
if 'EST' in line or 'EDT' in line: # look for Eastern Time
print(line)
https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen
No hay comentarios:
Publicar un comentario