Beispiel #1
0
 def __init__(self):
     client = Monzo(
         'access_token_goes_here'
     )  # Replace access token with a valid token found at: https://developers.getmondo.co.uk/
     account_id = client.get_first_account()[
         'id']  # Get the ID of the first account linked to the access token
     balance = client.get_balance(account_id)  # Get your balance object
     self.spend_today = balance['spend_today']
     self.balance = balance['balance']
Beispiel #2
0
    def __init__(self, secret_key=None):
        '''
        This method sets up variables to be used be other methods
        '''
        if secret_key is None:
            with open('/var/monzo/key', 'r') as f:
                secret_key = f.readline()

        client = Monzo(secret_key)
        self.client = client
        self.account_id = client.get_first_account()['id']
Beispiel #3
0
def index(request):
    app_name = request.build_absolute_uri().split('.')[0][8:]
    client = Monzo(os.environ.get('MONZO_ACCESS_TOKEN'))

    try:
        account = client.get_first_account()
        if account['closed']:
            account_id = client.get_accounts()['accounts'][1]['id']
        else:
            account_id = account['id']
    except (BadRequestError, UnauthorizedError):
        return render(request, 'invalid-token.html', {'app_name': app_name})

    return redirect('account', account_id)
from monzo.monzo import Monzo
from settings import get_environment_var

client = Monzo(get_environment_var('ACCESS_TOKEN'))
account_id = client.get_first_account()['id']
transactions = client.get_transactions(account_id)['transactions']
for transaction in transactions:
    if transaction['attachments']:
        for attachment in transaction['attachments']:
            client.deregister_attachment(attachment['id'])
from monzo.monzo import Monzo
from settings import get_environment_var

client = Monzo(get_environment_var('ACCESS_TOKEN'))
account_id = client.get_first_account()['id']
transactions = client.get_transactions(account_id)['transactions']
for transaction in transactions:
     if transaction['attachments']:
         for attachment in transaction['attachments']:
            client.deregister_attachment(attachment['id'])