fork download
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3.  
  4. # ЧИТАТЬ ЭТО
  5. # ха те те пе эс:// гит хаб точкаком/kennethreitz/requests/issues/1081
  6. # ЧИТАТЬ ЭТО
  7.  
  8. import requests
  9.  
  10. def fuck_requests(data):
  11. return { k: (None, v) for k, v in data.items() }
  12.  
  13. # Следи за тем, чтобы внутри были строки
  14. data = { 'a': '1', 'b': '2', 'c': 'Абу сосет хуи' }
  15. requests.post('http://127.0.0.1/makaba', files=fuck_requests(data))
  16.  
Runtime error #stdin #stdout #stderr 0.22s 18576KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
/bin/sh: 1: cannot create /dev/null: Permission denied
/bin/sh: 1: cannot create /dev/null: Permission denied
/bin/sh: 1: cannot create /dev/null: Permission denied
/bin/sh: 1: cannot create /dev/null: Permission denied
/bin/sh: 1: cannot create /dev/null: Permission denied
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 349, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.4/http/client.py", line 1137, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.4/http/client.py", line 1182, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.4/http/client.py", line 1133, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.4/http/client.py", line 963, in _send_output
    self.send(msg)
  File "/usr/lib/python3.4/http/client.py", line 898, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 155, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 134, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 88, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 78, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 597, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 245, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3/dist-packages/six.py", line 658, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 349, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.4/http/client.py", line 1137, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.4/http/client.py", line 1182, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.4/http/client.py", line 1133, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.4/http/client.py", line 963, in _send_output
    self.send(msg)
  File "/usr/lib/python3.4/http/client.py", line 898, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 155, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 134, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 88, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 78, in create_connection
    sock.connect(sa)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError(101, 'Network is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./prog.py", line 15, in <module>
  File "/usr/lib/python3/dist-packages/requests/api.py", line 109, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError(101, 'Network is unreachable'))