Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/acme
diff options
context:
space:
mode:
authorDamien Tournoud <damien@platform.sh>2017-03-27 19:24:05 +0300
committerJacob Hoffman-Andrews <github@hoffman-andrews.com>2017-03-27 19:24:05 +0300
commit5c93ceb67550ca4dd6e34d3edcda580cd4ab04c3 (patch)
treef943c9d77b7dc5974376447f5ecac187efe8f24c /acme
parent272a81b4005417f56f7fee5796d4d8a20f04531c (diff)
acme: Make the network timeout configurable (#4237)
This follows up on https://github.com/certbot/certbot/pull/4217, but allows users to override the default setting.
Diffstat (limited to 'acme')
-rw-r--r--acme/acme/client.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/acme/acme/client.py b/acme/acme/client.py
index 40291e115..0c8886fc6 100644
--- a/acme/acme/client.py
+++ b/acme/acme/client.py
@@ -33,6 +33,8 @@ if sys.version_info < (2, 7, 9): # pragma: no cover
import urllib3.contrib.pyopenssl # pylint: disable=import-error
urllib3.contrib.pyopenssl.inject_into_urllib3()
+DEFAULT_NETWORK_TIMEOUT = 45
+
DER_CONTENT_TYPE = 'application/pkix-cert'
@@ -503,13 +505,14 @@ class ClientNetwork(object): # pylint: disable=too-many-instance-attributes
REPLAY_NONCE_HEADER = 'Replay-Nonce'
def __init__(self, key, alg=jose.RS256, verify_ssl=True,
- user_agent='acme-python'):
+ user_agent='acme-python', timeout=DEFAULT_NETWORK_TIMEOUT):
self.key = key
self.alg = alg
self.verify_ssl = verify_ssl
self._nonces = set()
self.user_agent = user_agent
self.session = requests.Session()
+ self._default_timeout = timeout
def __del__(self):
self.session.close()
@@ -608,7 +611,7 @@ class ClientNetwork(object): # pylint: disable=too-many-instance-attributes
kwargs['verify'] = self.verify_ssl
kwargs.setdefault('headers', {})
kwargs['headers'].setdefault('User-Agent', self.user_agent)
- kwargs.setdefault('timeout', 45) # timeout after 45 seconds
+ kwargs.setdefault('timeout', self._default_timeout)
response = self.session.request(method, url, *args, **kwargs)
# If content is DER, log the base64 of it instead of raw bytes, to keep
# binary data out of the logs.