Skip to content

Remote end closed connection without response when using Geocaching.search() #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BelKed opened this issue Mar 6, 2022 · 6 comments · Fixed by #206
Closed

Remote end closed connection without response when using Geocaching.search() #182

BelKed opened this issue Mar 6, 2022 · 6 comments · Fixed by #206

Comments

@BelKed
Copy link
Contributor

BelKed commented Mar 6, 2022

When trying to load caches in some location using Geocaching.search(), it doesn't work because of error (Remote end closed connection without response).
However, loading a single geocache using Geocaching.get_cache() seems to work fine...


  • OS: macOS Monterey 12.6.1
  • Python version: 3.9.2
  • pycaching version: 4.2.3

Python code with error:

import pycaching

geocaching = pycaching.login("Username", "Password")

point = geocaching.geocode("Prague")

for cache in geocaching.search(point, limit=10):
    print(cache.name)

Error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pycaching/geocaching.py", line 82, in _request
    res = self._session.request(method, url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 723, in send
    history = [resp for resp in gen]
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 723, in <listcomp>
    history = [resp for resp in gen]
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 266, in resolve_redirects
    resp = self.send(
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 547, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/Documents/test.py", line 7, in <module>
    for cache in geocaching.search(point, limit=10):
  File "/usr/local/lib/python3.10/site-packages/pycaching/geocaching.py", line 257, in search
    geocaches_table, whole_page = self._search_get_page(point, start_index)
  File "/usr/local/lib/python3.10/site-packages/pycaching/geocaching.py", line 327, in _search_get_page
    res = self._request(
  File "/usr/local/lib/python3.10/site-packages/pycaching/geocaching.py", line 94, in _request
    if e.response.status_code == 429:  # Handle rate limiting errors
AttributeError: 'NoneType' object has no attribute 'status_code'

Edit: Updated the traceback.

@FriedrichFroebel
Copy link
Collaborator

Thanks for your report. When reviewing the latest pull request, I stumbled upon some issue when updating the test cases which seems to be related to this. At the moment some tests for the search functionality are either out-of-date or marked as expected failures.

I did not have yet have enough time for looking into this. Feel free to have a deeper look at this to get it back working as expected.

@OliverBurgert
Copy link

OliverBurgert commented May 5, 2022

I have exactly the same issue when I try the example from the docs:

point = Point(56.25263, 15.26738)

for cache in geocaching.search(point, limit=50):
    if cache.type == Type.traditional:
        print(cache.name)

Changing the limit (even to 1) does not make any difference.

@FriedrichFroebel
Copy link
Collaborator

I am not sure if we are able to do anything about this as already mentioned in my last comment. We might be able to catch this in https://github.com/tomasbedrich/pycaching/blob/master/pycaching/geocaching.py#L94 and report "Cannot load page" instead, but this would not be really helpful either. If you want to dig into this to find a solution, feel free to do so.

This might be fixed by #175 as well, but this is still work in progress without recent changes.

@TrollBlox
Copy link

I get the same issue except the error message is Remote end closed connection without response

@rainermensing
Copy link

rainermensing commented Nov 15, 2022

I get the same issue except the error message is Remote end closed connection without response
@TrollBlox Same here on version 4.2.3 with Python 3.10.7 on Windows 10

Traceback (most recent call last):
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Python310\lib\http\client.py", line 1374, in getresponse
    response.begin()
  File "C:\Python310\lib\http\client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "C:\Python310\lib\http\client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\util\retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\packages\six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Python310\lib\http\client.py", line 1374, in getresponse
    response.begin()
  File "C:\Python310\lib\http\client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "C:\Python310\lib\http\client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\pycaching\geocaching.py", line 82, in _request
    res = self._session.request(method, url, **kwargs)
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\sessions.py", line 723, in send
    history = [resp for resp in gen]
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\sessions.py", line 723, in <listcomp>
    history = [resp for resp in gen]
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\sessions.py", line 266, in resolve_redirects
    resp = self.send(
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\requests\adapters.py", line 547, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\adhoc.py", line 25, in <module>
    for cache in geocaching.search(point, limit=1):
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\pycaching\geocaching.py", line 257, in search
    geocaches_table, whole_page = self._search_get_page(point, start_index)
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\pycaching\geocaching.py", line 326, in _search_get_page
    res = self._request(
  File "C:\Users\raine\Documents\GitHub\geo-app\backend\venv\lib\site-packages\pycaching\geocaching.py", line 94, in _request
    if e.response.status_code == 429:  # Handle rate limiting errors
AttributeError: 'NoneType' object has no attribute 'status_code'

@BelKed BelKed changed the title Connection reset by peer when using geocaching.search Remote end closed connection without response when using Geocaching.search() Jan 15, 2023
@BelKed
Copy link
Contributor Author

BelKed commented Mar 30, 2023

I somehow forgot to mention this issue in #206, where it was also fixed...

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

Successfully merging a pull request may close this issue.

5 participants