requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError(0, 'Error'))

Summary.
Hello,

I try to connect from a python3.7 script to the marrytts text to spetch server to read a text

to reproduce this issue, please install a marrytts server abd run it with
./bin/marrytts-server &
befor test a script
## Expected Result

What you expected.
what request api don't work in my case ?
## Actual Result

textUrl = https://127.0.0.1:59125/?INPUT_TEXT=input+text
&INPUT_TYPE=text&OUTPUT_TYPE=audio&AUDIO=waveE&LOCALE=en
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 518, in urlopen
    body=body, headers=headers)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 322, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 727, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connection.py", line 238, in connect
    ssl_version=resolved_ssl_version)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/util/ssl_.py", line 253, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "callMarryTTs.py", line 78, in <module>
    callMarrytts(sys.stdin.read())
  File "callMarryTTs.py", line 47, in callMarrytts
    r = requests.get(textUrl)
  File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 49, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 564, in urlopen
    _pool=self, _stacktrace=stacktrace)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/util/retry.py", line 245, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/packages/six.py", line 309, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 518, in urlopen
    body=body, headers=headers)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 322, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 727, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/connection.py", line 238, in connect
    ssl_version=resolved_ssl_version)
  File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/util/ssl_.py", line 253, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError(0, 'Error'))



What happened instead.

## Reproduction Steps

```python
import requests
# https://toolbelt.readthedocs.io/en/latest/user.html#ssladapter

import requests
from requests_toolbelt import SSLAdapter
import ssl

def callMarrytts (text , lang="en",output_type="audio",output_format="wave") :

  #https://stackoverflow.com/questions/50300028/send-xml-file-to-rest-api-in-python3
    textReplace = text.replace(" ","+")

    textUrl = r'https://127.0.0.1:59125/?INPUT_TEXT{}&INPUT_TYPE=text&OUTPUT_TYPE={}&AUDIO={}E&LOCALE={}'.format(textReplace,output_type,output_format,lang)



```

## System Information

    $ python -m requests.help

python3.7 -m requests.help
/usr/bin/python3.7: No module named requests.help


```
<paste here>
```

This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
python3.7 --version
Python 3.7.5


operating system, &c).
mparchet@mparchet-Default-string:~/src/code-reader$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 19.10
Release:	19.10
Codename:	eoan

apt policy python3.7
python3.7:
  Installed: 3.7.5-2~19.10
  Candidate: 3.7.5-2~19.10
  Version table:
 *** 3.7.5-2~19.10 500
        500 http://mirror.serverius.net/ubuntu eoan-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     3.7.5~rc1-2 500
        500 http://mirror.serverius.net/ubuntu eoan/main amd64 Packages

uname -r
5.3.0-26-generic

could you help me please to fix this issue ?

Thanks by advance for your support

Best regards

Battant

Hi @Battant, this appears to be a connection issue with the server you have set up, likely with the TLS configuration.

This doesn’t appear to be a defect specifically with Requests from the information provided. I’d recommend testing some other tools like curl and/or postman and seeing if it’s reproducible there. If not, you can open a question on stackoverflow with the python-requests tag and look at debugging options there. Thanks!