Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

requests.exceptions.ConnectionError #4

Open
wacke opened this issue Jan 8, 2016 · 7 comments
Open

requests.exceptions.ConnectionError #4

wacke opened this issue Jan 8, 2016 · 7 comments

Comments

@wacke
Copy link

wacke commented Jan 8, 2016

Hi,

versuche gerade das Python-Beispiel von der Website auszuführen:

import requests
r = requests.get("https://meinsack.click/v1/70327/Ulmer%20Stra%C3%9Fe/")
print("Next: {}".format(r.json().get('dates')[0]))

bekomme als Antwort:

Traceback (most recent call last):
  File "./request.py", line 4, in <module>
    r = requests.get("https://meinsack.click/v1/70327/Ulmer%20Stra%C3%9Fe/")
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 49, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))

WHY?!

@momorientes
Copy link
Contributor

can not reproduce, can you provide any hints on what you did or when you did it so we can check logs?

Python 2.7.11 (default, Dec 26 2015, 17:47:53)
In [1]: import requests
In [2]: r = requests.get("https://meinsack.click/v1/70327/Ulmer%20Stra%C3%9Fe/")
In [3]: print("Next: {}".format(r.json().get('dates')[0]))
Next: 2016-01-11

@mfa
Copy link
Member

mfa commented Jan 9, 2016

same for python3:

Python 3.4.3 (default, Oct 14 2015, 20:28:29) 
>>> import requests
>>> r = requests.get("https://meinsack.click/v1/70327/Ulmer%20Stra%C3%9Fe/")
>>> print("Next: {}".format(r.json().get('dates')[0]))
Next: 2016-01-11

@wacke
Copy link
Author

wacke commented Jan 9, 2016

Hi,

➜  gelber_sack  uname -a
Darwin mbp.local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
➜  gelber_sack  python             
Python 2.7.10 (default, Aug 22 2015, 20:33:39) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> print datetime.now()
2016-01-09 14:09:32.203886
>>> import requests
>>> print requests.__version__
2.5.3
>>> r = requests.get("https://meinsack.click/v1/70327/Ulmer%20Stra%C3%9Fe/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 49, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))
>>> r = requests.get("https://heise.de/")
>>>

Nachtrag:

r = requests.get("https://meinsack.click/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 49, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))
>>> 

@mfa
Copy link
Member

mfa commented Jan 9, 2016

maybe the letsencrypt-ssl-certificate is the problem.

r = requests.get("https://meinsack.click/v1/", verify=False)
print(r.json())

@wacke
Copy link
Author

wacke commented Jan 9, 2016

Does not help:

Traceback (most recent call last):
  File "./request.py", line 4, in <module>
    r = requests.get("https://meinsack.click/v1/70327/Ulmer%20Stra%C3%9Fe/", verify=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 49, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))

PS: same behavior with http w/o "s"

@wacke
Copy link
Author

wacke commented Jan 9, 2016

hier noch bisschen tcpdump zum schmöckern:

16:43:36.052248 IP 192.168.0.11.62387 > api.hackathon.de.http: Flags [S], seq 467355974, win 65535, options [mss 1460,nop,wscale 5,nop,nop,TS val 1386422207 ecr 0,sackOK,eol], length 0
16:43:36.069298 IP api.hackathon.de.http > 192.168.0.11.62387: Flags [S.], seq 2224423052, ack 467355975, win 28960, options [mss 1460,sackOK,TS val 239823754 ecr 1386422207,nop,wscale 7], length 0
16:43:36.069399 IP 192.168.0.11.62387 > api.hackathon.de.http: Flags [.], ack 1, win 4117, options [nop,nop,TS val 1386422223 ecr 239823754], length 0
16:43:36.069795 IP 192.168.0.11.62387 > api.hackathon.de.http: Flags [P.], seq 1:203, ack 1, win 4117, options [nop,nop,TS val 1386422224 ecr 239823754], length 202: HTTP: GET /v1/70327/Ulmer%20Stra%C3%9Fe/ HTTP/1.1
16:43:36.088534 IP api.hackathon.de.http > 192.168.0.11.62387: Flags [.], ack 203, win 235, options [nop,nop,TS val 239823759 ecr 1386422224], length 0
16:43:36.088885 IP api.hackathon.de.http > 192.168.0.11.62387: Flags [P.], seq 1:387, ack 203, win 235, options [nop,nop,TS val 239823759 ecr 1386422224], length 386: HTTP: HTTP/1.1 302 Moved Temporarily
16:43:36.088997 IP 192.168.0.11.62387 > api.hackathon.de.http: Flags [.], ack 387, win 4105, options [nop,nop,TS val 1386422242 ecr 239823759], length 0
16:43:36.095126 IP 192.168.0.11.62388 > api.hackathon.de.https: Flags [S], seq 837322935, win 65535, options [mss 1460,nop,wscale 5,nop,nop,TS val 1386422247 ecr 0,sackOK,eol], length 0
16:43:36.113776 IP api.hackathon.de.https > 192.168.0.11.62388: Flags [S.], seq 2642376410, ack 837322936, win 28960, options [mss 1460,sackOK,TS val 239823765 ecr 1386422247,nop,wscale 7], length 0
16:43:36.113859 IP 192.168.0.11.62388 > api.hackathon.de.https: Flags [.], ack 1, win 4117, options [nop,nop,TS val 1386422264 ecr 239823765], length 0
16:43:36.138576 IP 192.168.0.11.62388 > api.hackathon.de.https: Flags [P.], seq 1:98, ack 1, win 4117, options [nop,nop,TS val 1386422287 ecr 239823765], length 97
16:43:36.158222 IP api.hackathon.de.https > 192.168.0.11.62388: Flags [.], ack 98, win 227, options [nop,nop,TS val 239823777 ecr 1386422287], length 0
16:43:36.158717 IP api.hackathon.de.https > 192.168.0.11.62388: Flags [R.], seq 1, ack 98, win 227, options [nop,nop,TS val 239823777 ecr 1386422287], length 0
16:43:36.171018 IP 192.168.0.11.62387 > api.hackathon.de.http: Flags [F.], seq 203, ack 387, win 4105, options [nop,nop,TS val 1386422317 ecr 239823759], length 0
16:43:36.194157 IP api.hackathon.de.http > 192.168.0.11.62387: Flags [F.], seq 387, ack 204, win 235, options [nop,nop,TS val 239823786 ecr 1386422317], length 0
16:43:36.194232 IP 192.168.0.11.62387 > api.hackathon.de.http: Flags [.], ack 388, win 4105, options [nop,nop,TS val 1386422338 ecr 239823786], length 0

@momorientes
Copy link
Contributor

Can reproduce with python 2.7.10 on Mac OS X Yosemite. Interesting...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants