From 6ea48da2fbb0148aebde6dff05b8237df75d996f Mon Sep 17 00:00:00 2001 From: Itay Brandes Date: Wed, 10 May 2017 08:57:26 +0300 Subject: [PATCH] Added a `_retries` variable at the main module file (`musicbrainz.py`). Underscored so people only use if they know what they're doing. Solved issues #174 and #218. Signed-off-by: Itay Brandes --- musicbrainzngs/musicbrainz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/musicbrainzngs/musicbrainz.py b/musicbrainzngs/musicbrainz.py index 2ac5ce94..b46ecdcb 100644 --- a/musicbrainzngs/musicbrainz.py +++ b/musicbrainzngs/musicbrainz.py @@ -22,6 +22,7 @@ _version = "0.7dev" _log = logging.getLogger("musicbrainzngs") +_max_retries = 8 LUCENE_SPECIAL = r'([+\-&|!(){}\[\]\^"~*?:\\\/])' @@ -461,7 +462,7 @@ def get_method(self): # Core (internal) functions for calling the MB API. -def _safe_read(opener, req, body=None, max_retries=8, retry_delay_delta=2.0): +def _safe_read(opener, req, body=None, max_retries=_max_retries, retry_delay_delta=2.0): """Open an HTTP request with a given URL opener and (optionally) a request body. Transient errors lead to retries. Permanent errors and repeated errors are translated into a small set of handleable