summaryrefslogtreecommitdiff
path: root/tools/certtools.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/certtools.py')
-rw-r--r--tools/certtools.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/certtools.py b/tools/certtools.py
index f5482cb..7a5f9fc 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -18,6 +18,7 @@ import shutil
import requests
import warnings
import logging
+from time import sleep
from certkeys import publickeys
@@ -131,6 +132,15 @@ def get_sth(baseurl):
result.raise_for_status()
return result.json()
+def get_sth_retry(baseurl, tries=1):
+ for i in range(tries):
+ try:
+ return get_sth(baseurl)
+ except requests.exceptions.HTTPError, e:
+ if e.response.status_code == 500:
+ sleep(1)
+ raise e
+
def get_proof_by_hash(baseurl, hash, tree_size):
params = {"hash":base64.b64encode(hash),
"tree_size":tree_size}