blob: bb5b39c4bbb6e76317adcfa875c88e5f782e1817 [file] [log] [blame] [edit]
import sys
if __name__ == "__main__":
try:
from urllib.request import URLError, urlopen
except ImportError:
from urllib2 import URLError, urlopen
url = sys.argv[1]
headers = {"Content-Type": "text/plain; charset=utf-8"}
try:
resp = urlopen(url)
line = resp.readline().decode("ascii") # py3
except URLError:
line = "failed to read %s" % url
sys.stdout.write(line)
sys.stdout.flush()