fork download
  1. import json
  2. from contextlib import closing
  3. from urllib2 import urlopen
  4.  
  5. with closing(urlopen('http://f...content-available-to-author-only...p.net/json/')) as response:
  6. location = json.load(response)
  7.  
  8. print(json.dumps(location, indent=4, sort_keys=True)) # pretty-print
Runtime error #stdin #stdout #stderr 0.14s 13288KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 5, in <module>
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 401, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 419, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1211, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1181, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>