Note that there are some explanatory texts on larger screens.

plurals
  1. POPython Requests Library timing out under Linux
    primarykey
    data
    text
    <p>I am attempting to use the requests.py library for calls to a rest web service. I wrote a quick prototype for my usage under windows and everything worked fine, but when I attempted to run the same prototype under linux I get a "requests.exceptions.Timeout: Request timed out" error. Does anyone know why this might be happening? If I try to use the library to access a non https url it works fine under both windows and linux.</p> <pre><code>import requests url = 'https://path.to.rest/svc/?options' r = requests.get(url, auth=('uid','passwd'), verify=False) print(r.content) </code></pre> <p>I did notice that if I leave off the verify=False parameter from the get call, I get a different exception, namely "requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available". This appears to be a possible underlying cause, though I dont know why they would change the errorcode, but I cant find any reference to an ssl module and I verified that certifi was installed. Interestingly, if I leave off the verify parameter in windows I get a different exception, "requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"</p> <p>EDIT:</p> <p>Tracebacks for all cases/scenarios mentioned</p> <p>Full code as shown above:</p> <pre><code>Traceback(most recent call last): File "testRequests.py", line 15, in &lt;module&gt; r = requests.get(url, auth=('uid','passwd'), verify=False) File "build/bdist.linux-x86_64/egg/requests/api.py", line 52, in get File "build/bdist.linux-x86_64/egg/requests/api.py", line 40, in request File "build/bdist.linux-x86_64/egg/requests/sessions.py", line 208, in request File "build/bdist.linux-x86_64/egg/requests/models.py", line 586, in send requests.exceptions.Timeout: Request timed out </code></pre> <p>Code as shown above minus the "verify=False" paramter:</p> <pre><code>Traceback(most recent call last): File "testRequests.py", line 15, in &lt;module&gt; r = requests.get(url, auth=('uid','passwd')) File "build/bdist.linux-x86_64/egg/requests/api.py", line 52, in get File "build/bdist.linux-x86_64/egg/requests/api.py", line 40, in request File "build/bdist.linux-x86_64/egg/requests/sessions.py", line 208, in request File "build/bdist.linux-x86_64/egg/requests/models.py", line 584, in send requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available </code></pre> <p>Code as show above minus the "verify=False" parameter and run under windows:</p> <pre><code>Traceback(most recent call last): File "testRequests.py", line 59, in &lt;module&gt; r = requests.get(url, auth=('uid','passwd')) File "c:\Python27\lib\site-packages\requests\api.py", line 52, in get return request('get', url, **kwargs) File "c:\Python27\lib\site-packages\requests\api.py", line 40, in request return s.request(method=method, url=url, **kwargs) File "c:\Python27\lib\site-packages\requests\sessions.py", line 208, in request r.send(prefetch=prefetch) File "c:\Python27\lib\site-packages\requests\models.py", line 584, in send raise SSLError(e) requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload