requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:590)

Hi, 
I don't why all of a sudden I get this error, it worked perfectly fine before.
I work with python 2.7.10, in windows.

**This is my code:**

```
def checkCreds():
    response= requests.get(apiPath + 'hello world' , auth=(user, pasw), verify=False)
    return response.status_code 
```

**and I get this error:**

```
File "C:\Users\sh\GUI.py", line 343, in handleLogin
    if checkCreds()==HTTP_OK: 
  File "C:\Users\sh\GUI.py", line 212, in checkCreds
    response= requests.get(apiPath + 'hello world' , auth=(user, pasw), verify=False)
  File "C:\Python27\lib\requests\api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Python27\lib\requests\api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "C:\Python27\lib\requests\sessions.py", line 471, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\requests\sessions.py", line 579, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\requests\adapters.py", line 430, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:590)
```

Please help!


This error is almost always the result of the server not liking your TLS configuration. Can you show me the output of `python -m pip freeze` and `python -c "import ssl; print ssl.OPENSSL_VERSION"` please?


`python -m pip freeze`
cffi==1.8.3
chatter==0.1.3
cryptography==1.5
cx-Freeze==4.3.4
cycler==0.10.0
elementtree==1.2.6.post2005
enum34==1.1.6
et-xmlfile==1.0.1
freetype-py==1.0.2
future==0.15.2
idna==2.1
ipaddress==1.0.17
jdcal==1.2
Jinja2==2.8
MarkupSafe==0.23
matplotlib==1.5.1
MySQL-python==1.2.4b4
ndg-httpsclient==0.4.2
nltk==3.2.1
numpy==1.10.1
openpyxl==2.4.0a1
pathlib==1.0.1
pefile==2016.3.28
py2exe==0.6.9
pyasn1==0.1.9
pycparser==2.14
pyenchant==1.6.6
pyforms==0.1.3
pyinstaller==3.2
pymssql==2.1.1
pynsist==1.7
pyodbc==3.0.7
PyOpenGL==3.1.0
pyOpenSSL==16.1.0
pyparsing==2.1.4
pypng==0.0.18
python-dateutil==2.5.3
pytz==2016.4
pywin32==220
requests==2.11.1
requests-download==0.1.1
six==1.10.0
urllib3==1.17
visvis==1.8
win-cli-launchers==0.1
xlsxwriter==0.8.7
yarg==0.1.9

`python -c "import ssl; print ssl.OPENSSL_VERSION"`
OpenSSL 1.0.2a 19 Mar 2015


Hrm, did you update Requests in any way?


I tried but it says it is already up to date (but I got the error above before trying to update)


No, I'm sorry, I wasn't clear. You said that "it worked perfectly fine before". What I'm trying to work out is, what did you to between the time it last worked and now, when it does not work.


Nothing actually. The last time I modified the code was 10 days ago and it worked fine back then.


Literally _nothing_ changed? You didn't change the installed versions of packages, your virtual environment, your OpenSSL version, your operating system, your network, _nothing_? 


The only thing I can think of is that I installed pyinstaller and pynsist in order to make my files executable, but I don't think I changed versions of packages that worked fine (but definitely didn't change virtual environment, OpenSSL version, operating system, or network)


The thing I did try this morning is to add environment variable HTTPS_PROXY but this gave me this:
`File "C:\Users\sh\GUI3.py", line 216, in checkCreds
    response= requests.get(apiPath + 'hello world' , auth=(user, pasw), verify=False)
  File "C:\Python27\lib\requests\api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Python27\lib\requests\api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "C:\Python27\lib\requests\sessions.py", line 471, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\requests\sessions.py", line 579, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\requests\adapters.py", line 430, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)
`


HTTPS_PROXY is unlikely to be relevant. Do you have proxies configured?


yes


@Sh-Ho So if your system hasn't changed there are only two options. Either the proxy has changed or the server has. In either case, the failure mode is simply that the connection is getting closed in the face of the Client Hello TLS message. It's extremely hard to work out what that is without quite a lot of knowledge and some guess work. Ideally we'd have a packet capture from the previous handshake and one from the new handshake.

However, given the way these kinds of things usually go, I'd start by investigating the proxy. Ideally you should consult with the operator of the proxy to see why it's shutting down your handshake.