-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquicktest.py
More file actions
33 lines (27 loc) · 921 Bytes
/
quicktest.py
File metadata and controls
33 lines (27 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import monzo.oauth.monzotoken as monzotoken
import monzo.api.monzoapi as monzoapi
import monzo.model.monzotransaction as monzotransaction
import monzo.model.monzoaccount as monzoaccount
import monzo.model.monzobalance as monzobalance
token = monzotoken.MonzoToken()
api = monzoapi.MonzoApi(token.access_token)
if not api.is_authenticated():
token.refresh()
api.access_token = token.access_token
if not api_is_authenticated():
raise Exception("API Not authenticated!")
accounts = monzoaccount.MonzoAccount.listAccounts(api)
for a in accounts:
if a.account_type=="uk_retail":
account = a
break
print(a.readBalance())
transactions = a.listTransactions()
balance = monzobalance.MonzoBalance(a.account_id)
print(balance)
t = transactions[1]
print(t.trans_id)
t = monzotransaction.MonzoTransaction.retrieveTransaction(api,t.trans_id)
print(t.merchant)
t.expand()
print(t.merchant)