python 파충류 만 나 기 dohandshake_on_connect should not be specified for non-blocking sockets

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\javascript\Desktop\library\library-dev\cqulibrary\views.py", line 218, in jieyue
    'https://sso.lib.cqu.edu.cn:8949/adlibSso/login',verify = False)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\site-packages\requests\adapters.py", line 423, in send
    timeout=timeout
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\connection.py", line 326, in connect
    ssl_context=context)
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\util\ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python27\lib\ssl.py", line 352, in wrap_socket
    _context=self)
  File "C:\Python27\lib\ssl.py", line 578, in __init__
    raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
ValueError: do_handshake_on_connect should not be specified for non-blocking sockets

수 차례 의 고생 끝 에 이 방법 으로 해결 해 야 한다.pip install requests[security]
이렇게 하면 다음 세 개의 가방 을 추가 로 설치 할 수 있 습 니 다.
pyOpenSSL
cryptography
idna

이렇게 하면 더 많은 안전 한 SSL 연결 을 허용 할 수 있다.
Also by default requests can't connect to some sites on OSX because of ancient OpenSSL. Using the above 3 packages makes it possible. (Donald Stufft)

좋은 웹페이지 즐겨찾기