#92 Catch also RetryError in get_json
Merged 3 years ago by frantisekz. Opened 3 years ago by frantisekz.

@@ -30,7 +30,7 @@ 

  

  from urllib3.util.retry import Retry

  from requests.adapters import HTTPAdapter

- from requests.exceptions import ConnectionError

+ from requests.exceptions import ConnectionError, RetryError

  from json import JSONDecodeError

  

  from oraculum import app, CACHE, db
@@ -52,7 +52,7 @@ 

          session.mount('https://', HTTPAdapter())

      try:

          resp = session.get(json_url, timeout=60)

-     except ConnectionError:

+     except (ConnectionError, RetryError):

          # Return none if retrying failed too

          if log_errors:

              app.logger.error("Request to %s failed." % json_url)

... so oraculum doesn't blow up when something doesn't work

Pull-Request has been merged by frantisekz

3 years ago
Metadata