python3 global name 'SOL_SOCKET is not defined
<p>when I use <code>gevent</code>, I can not use <code>requests</code>, is my useage wrong?</p>

<pre><code>from gevent import monkey; monkey.patch_all()
import gevent, requests
requests.get('https://haofly.net')
</code></pre>

<p>it raise the error:</p>

<pre><code>Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in &lt;module&gt;
File "/usr/local/lib/python3.3/site-packages/requests/api.py", line 70, in get
  return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.3/site-packages/requests/api.py", line 56, in request
  return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 475, in request
  resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 596, in send
  r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 352, in _make_request
  self._validate_conn(conn)
File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 831, in _validate_conn
  conn.connect()
File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connection.py", line 289, in connect
  ssl_version=resolved_ssl_version)
File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
  return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/lib/python3.3/site-packages/gevent/_ssl3.py", line 60, in wrap_socket
  _context=self)
File "/usr/local/lib/python3.3/site-packages/gevent/_ssl3.py", line 143, in __init__
  if sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM:
NameError: global name 'SOL_SOCKET' is not defined
</code></pre>

<p>The version of my Python is 3.3</p>

<p>If I add <code>ssl=False</code> to <code>monkey.patch_all()</code>, it returns:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/local/lib/python3.3/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.3/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 352, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connectionpool.py", line 831, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/connection.py", line 289, in connect
    ssl_version=resolved_ssl_version)
  File "/usr/local/lib/python3.3/site-packages/requests/packages/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/lib/python3.3/ssl.py", line 245, in wrap_socket
    _context=self)
  File "/usr/local/lib/python3.3/ssl.py", line 335, in __init__
    server_hostname)
TypeError: _wrap_socket() argument 1 must be _socket.socket, not SSLSocket
</code></pre>

<p>Install the Python 3.5 version can fix this problem.</p>

python python-3.x python-3.3