Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
minor updates to download-blockchain-wallet.py [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
gurnec committed Oct 13, 2017
1 parent 7e5c735 commit 56a0dbf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extract-scripts/download-blockchain-wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def do_request(query, body = None):
req.add_data((body+"&" if body else "") + "api_code=" + API_CODE)
if auth_token:
req.add_header("authorization", "Bearer " + auth_token)
return urllib2.urlopen(req)
try:
return urllib2.urlopen(req, cadefault=True) # calls ssl.create_default_context() (despite what the docs say)
except TypeError:
return urllib2.urlopen(req) # Python < 2.7.9 doesn't support the cadefault argument
#
# Performs a do_request(), decoding the result as json
def do_request_json(query, body = None):
Expand All @@ -85,6 +88,8 @@ def do_request_json(query, body = None):
error_msg = json.loads(error_msg)["initial_error"]
except: pass
print(error_msg)
if error_msg.lower().startswith("unknown wallet identifier"):
sys.exit(1)

# Wait for the user to complete the requested authorization
time.sleep(5)
Expand Down

0 comments on commit 56a0dbf

Please sign in to comment.