From 4e5fd88944b3c72a67e71106af01b14b263ce7a1 Mon Sep 17 00:00:00 2001 From: Nebojsa Knezevic Date: Wed, 7 Dec 2022 22:34:39 +0100 Subject: [PATCH] Trigger retry mechanism on status --- .gitignore | 1 + googlemaps/client.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 93e7a2fc..f1b00811 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ dist/ .coverage .nox env +.env googlemaps.egg-info *.egg .vscode/ diff --git a/googlemaps/client.py b/googlemaps/client.py index d1f4ab6a..6c08564e 100644 --- a/googlemaps/client.py +++ b/googlemaps/client.py @@ -366,6 +366,9 @@ def _get_body(self, response): raise googlemaps.exceptions._OverQueryLimit( api_status, body.get("error_message")) + if api_status == "INVALID_REQUEST": + raise googlemaps.exceptions._RetriableRequest() + raise googlemaps.exceptions.ApiError(api_status, body.get("error_message"))