CoCalc Public FilesPublic / PYTHON / 02-get-my-account-id.ipynbOpen with one click!
Authors: Hal Snyder, ℏal Snyder
Views : 152
Description: use API to get account_id
Compute Environment: Ubuntu 18.04 (Deprecated)

Get Account ID for user who owns the api_key

In [1]:
# import utility definitions %run ./01-utils.ipynb
In [2]:
# load credentials uinfo = load_user_info("../../SECRET/testuser.yaml")
In [ ]:
# make an API call payload = {"query":{"accounts":{"account_id":None}}} response = call_api("query", payload, uinfo['api_key']) pp.pprint(response) ## expected result, last line contains the account id: # # {'event': 'query', # 'id': '...' # message id for the API request # 'multi_response': False, # for internal use, may be ignored # 'query': {'accounts': {'account_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}}} # this is the account id
In [ ]: