diff --git a/TODO b/TODO index 8aa620b..e016747 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,10 @@ Poor Maps 0.6.1 =============== - [X] Retry geocoding or routing in case of http.BadStatusLine error, - which probably implies a broken connection, which seems to probably - happen when a persistent HTTP connection was made, but lost due to - the device going to sleep + [X] Retry geocoding or routing in case of http.client.BadStatusLine + error, which probably implies a broken connection, which seems + to probably happen when a persistent HTTP connection was made, + but lost due to the device going to sleep [X] Only cache successful geocoding and routing results Poor Maps 0.7 diff --git a/poor/http.py b/poor/http.py index 4bb5bf3..f0fc9b4 100644 --- a/poor/http.py +++ b/poor/http.py @@ -73,7 +73,7 @@ def request_url(url, encoding=None, retry=1): return blob.decode(encoding, errors="replace") except Exception as error: remove_connection(url) - if isinstance(error, http.BadStatusLine) and retry > 0: + if isinstance(error, http.client.BadStatusLine) and retry > 0: # This probably means that the connection was broken. return request_url(url, encoding, retry-1) print("Failed to download data: {}" diff --git a/poor/tilesource.py b/poor/tilesource.py index c072708..5506d3b 100644 --- a/poor/tilesource.py +++ b/poor/tilesource.py @@ -85,7 +85,7 @@ def download(self, x, y, zoom, retry=1): except Exception as error: httpc.close() httpc = self._init_http_connection() - if isinstance(error, http.BadStatusLine) and retry > 0: + if isinstance(error, http.client.BadStatusLine) and retry > 0: # This probably means that the connection was broken. return self.download(x, y, zoom, retry-1) print("Failed to download tile: {}"