Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!venv/bin/python
- import sys
- import requests, json
- from prettytable import PrettyTable
- from requests import RequestException
- from requests.auth import HTTPBasicAuth
- import getpass
- username = input("username: ")
- password = getpass.getpass("password: ")
- try:
- r = requests.get('https://www.ag-bank.com/API/accounts.json', auth=HTTPBasicAuth(username, password))
- r.raise_for_status()
- except RequestException as e:
- print(e)
- sys.exit(0)
- response = json.loads(r.text)
- table = PrettyTable(["retail","currency","balance_credit"])
- for i in response:
- table.add_row([
- i['retail'],
- i['currency'],
- i['balance']['credit'],
- ])
- print(table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement