This repository has been archived by the owner on Jul 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upbank.10m.py
executable file
·38 lines (31 loc) · 5.45 KB
/
upbank.10m.py
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
34
35
36
37
38
#!/usr/bin/env python3
import requests
import re
# ===============
up_token = ""
# ===============
url = "https://api.up.com.au/api/v1/accounts"
icon = "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAACXBIWXMAAC4jAAAuIwF4pT92AAAGzmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDYwLCAyMDIwLzA1LzEyLTE2OjA0OjE3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG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Ljx2M0gIspVxdm+MoksJSOedU5mByDLO/BCHwbKGYMnU3lfA58bQSxtqHrRzBUwQI4gWbpMgfzjy2kMkm5hKOs7RbLAxlPCeF7u/TQbJoSm+iGUkkvQyvKgJJYT6mCoAg2nGcx7roZ3Q96ySkWr8JALvqfNvoxjw8KwDMTAVW1qKar3CymyhNwMg63zX1IIo+KApmUrkO5NINLyy0xoIz3gQRjRex9CWZJDazgiUkMZvRTGI4b3NI6P4arRhKMolMJIQY3mcwfvRnCJEMIoZ4xhJKR1zxwISCO44sJYPR+CtECol0MqUcYB7t6cACFuFNLAM4wgYO8iv5HGAbF0kngc08EAAyCWcVcJx29OEzDpNLDkXc4hxjiCaODcAC/CkgjYEUsIANHGImqxS6kMynLCSeSIKIYhjRmFBwoT8mFCxYUPBQt5AHCgpzNDmQG00JowcKCs0IpytmhhJHVxS8MGNiCp1Q8KEXLYgmCgUvAgnWLo3afis5I7kXJ+kiv/brwBn3l7srDpO8xBLNRXbzurT1cgAbbWTHFScMU0MDeHJdACio+0eK+gJMtHE+thuAeAx5LJ2d7QQwlpvc4Ta3KSW78b+e1/P5H067cp9hIQz2AAAAAElFTkSuQmCC"
headers = {
'Authorization': f'Bearer {up_token}'
}
response = requests.request("GET", url, headers=headers)
if response.status_code == 200:
print(f' | templateImage={icon}')
print('---')
print('ACCOUNT BALANCES | size=10')
for data in response.json()['data']:
if re.findall(r'[^\w\s,]', data['attributes']['displayName']):
acc_name = data['attributes']['displayName']
else:
acc_name = "⚡ " + data['attributes']['displayName']
acc_value = data['attributes']['balance']['value']
print(f"{ acc_name } - ${ acc_value }")
else:
print(f'⚠️ | templateImage={icon}')
print('---')
print('REQUEST FAILED | size=10')
for data in response.json()['errors']:
title = data['title']
detail = data['detail']
print(f'⚠️ {title} - {detail}')