Open ianbstewart opened 3 years ago
I was investigating a different warning, but I think the root cause is the same: Geocoder does not explicitly close the HTTP session it makes use of: https://github.com/DenisCarriere/geocoder/blob/39b9999ec70e61da9fa52fe9fe82a261ad70fa8b/geocoder/base.py#L389 It is by design, since it can reuse a session created elsewhere. Even though I would expect it to close itself the session it creates on its own or at least clearly document this in the docs (the section “Using a Session” has no mention of the fact that Geocoder will create a session if one is not provided in the kwargs).
The solution is to explicitly close the session after you’ve retrieved the results:
result = geocoder.osm( ... )
result.session.close()
After using
geocoder.osm
for a few hundred queries, I get the same error over and over fromgeocoder
:I don't think that the problem is on my end. It seems like a weird version of rate limiting. I added a sleep function for 5 seconds between queries but that didn't change anything. How to fix this error?