Created
October 29, 2016 19:44
-
-
Save benrules2/34be7f85d9a6af499717467199fb4eb5 to your computer and use it in GitHub Desktop.
Get Balance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_balance(base_url, username, password): | |
url = base_url + "/v1/client/balance" | |
b64str = base64.b64encode("{}:{}".format(username,password).encode('utf-8')) | |
headers = {'Content-length' : '0', | |
'Content-type' : 'application/json', | |
'Authorization' : "Basic " + b64str.decode('utf-8')} | |
req = ulib.Request(url, headers=headers) | |
responseData = ulib.urlopen(req).read() | |
balance = json.loads(responseData.decode('utf-8')) | |
return balance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment