fork download
  1. import urllib.request
  2. import json
  3. test = urllib.request.urlopen('https://a...content-available-to-author-only...k.com/method/users.get?user_ids=1&v=5.27').read().decode()
  4. s = json.loads(test)
  5. print(s.get('response')[0].get('first_name'))
Runtime error #stdin #stdout #stderr 0.34s 15440KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "/usr/lib/python3.2/urllib/request.py", line 1140, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/lib/python3.2/http/client.py", line 970, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.2/http/client.py", line 1008, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.2/http/client.py", line 966, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.2/http/client.py", line 811, in _send_output
    self.send(msg)
  File "/usr/lib/python3.2/http/client.py", line 749, in send
    self.connect()
  File "/usr/lib/python3.2/http/client.py", line 1103, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python3.2/socket.py", line 397, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./prog.py", line 3, in <module>
  File "/usr/lib/python3.2/urllib/request.py", line 139, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.2/urllib/request.py", line 370, in open
    response = self._open(req, data)
  File "/usr/lib/python3.2/urllib/request.py", line 388, in _open
    '_open', req)
  File "/usr/lib/python3.2/urllib/request.py", line 348, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.2/urllib/request.py", line 1176, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.2/urllib/request.py", line 1143, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>