diff options
-rw-r--r-- | tools/certtools.py | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index 7796a2c..ed8ab30 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -136,22 +136,15 @@ def pyopenssl_https_get(url): return response_lines[len(response_lines) - 1] def get_sth(baseurl): - try: - result = urlopen(baseurl + "ct/v1/get-sth").read() - except urllib2.URLError: - result = pyopenssl_https_get(baseurl + "ct/v1/get-sth") + result = urlopen(baseurl + "ct/v1/get-sth").read() return json.loads(result) def get_proof_by_hash(baseurl, hash, tree_size): try: params = urllib.urlencode({"hash":base64.b64encode(hash), "tree_size":tree_size}) - try: - result = \ - urlopen(baseurl + "ct/v1/get-proof-by-hash?" + params).read() - except urllib2.URLError: - result = \ - pyopenssl_https_get(baseurl + "ct/v1/get-proof-by-hash?" + params) + result = \ + urlopen(baseurl + "ct/v1/get-proof-by-hash?" + params).read() return json.loads(result) except urllib2.HTTPError, e: print "ERROR:", e.read() @@ -161,12 +154,8 @@ def get_consistency_proof(baseurl, tree_size1, tree_size2): try: params = urllib.urlencode({"first":tree_size1, "second":tree_size2}) - try: - result = \ - urlopen(baseurl + "ct/v1/get-sth-consistency?" + params).read() - except urllib2.URLError: - result = \ - pyopenssl_https_get(baseurl + "ct/v1/get-sth-consistency?" + params) + result = \ + urlopen(baseurl + "ct/v1/get-sth-consistency?" + params).read() return json.loads(result)["consistency"] except urllib2.HTTPError, e: print "ERROR:", e.read() @@ -227,9 +216,6 @@ def get_entries(baseurl, start, end): try: result = urlopen(baseurl + "ct/v1/get-entries?" + params).read() return json.loads(result) - except urllib2.URLError: - result = pyopenssl_https_get(baseurl + "ct/v1/get-entries?" + params) - return json.loads(result) except urllib2.HTTPError, e: print "ERROR:", e.read() sys.exit(1) |