In [1]:
import json
import oandapyV20
import oandapyV20.endpoints.accounts as accounts
from exampleauth import exampleauth
accountID, access_token = exampleauth.exampleAuth()
client = oandapyV20.API(access_token=access_token)
r = accounts.AccountList()
response = client.request(r)
print(json.dumps(response, indent=2))
In [2]:
print("API-path: " , r)
print("METHOD: ", r.method)
print("Response status: ", r.status_code)
print("The account id's: ", [acc.get('id') for acc in r.response.get('accounts')])