22import sys
33import time
44from urllib .parse import urlencode
5- from transifex .native .django import settings as native_settings
65
76import requests
87from transifex .native .consts import (KEY_CHARACTER_LIMIT ,
@@ -58,7 +57,7 @@ class CDSHandler(object):
5857
5958 def __init__ (self , configured_languages , token , secret = None ,
6059 host = TRANSIFEX_CDS_HOST , fetch_all_langs = False ,
61- filter_tags = None , filter_status = None ):
60+ filter_tags = None , filter_status = None , fetch_timeout = 0 ):
6261 """Constructor.
6362
6463 :param list configured_languages: a list of language codes for the
@@ -74,6 +73,7 @@ def __init__(self, configured_languages, token, secret=None,
7473 self .secret = secret
7574 self .host = host or TRANSIFEX_CDS_HOST
7675 self .etags = EtagStore ()
76+ self .fetch_timeout = fetch_timeout
7777
7878 def fetch_languages (self ):
7979 """Fetch the languages defined in the CDS for the specific project.
@@ -368,7 +368,7 @@ def retry_get_request(self, *args, **kwargs):
368368 retries_5xx = 0
369369 last_response_status = 202
370370 start_ts = time .time ()
371- max_total_seconds = native_settings . TRANSIFEX_FETCH_TEMEOUT
371+ max_total_seconds = self . fetch_timeout
372372
373373 while True :
374374 response = requests .get (* args , ** kwargs )
0 commit comments