-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
executable file
·41 lines (29 loc) · 1.24 KB
/
example.py
File metadata and controls
executable file
·41 lines (29 loc) · 1.24 KB
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
39
40
41
#!/usr/bin/env python3
import os
from aaisp import AAISP
# --------------------------------------------------------------------------- #
def main():
print("-------------------------")
print("AAISP Lines")
print("-------------------------\n")
username = os.environ.get('AAISP_USERNAME')
password = os.environ.get('AAISP_PASSWORD')
if not username or not password:
print("Environment variables AAISP_USERNAME and AAISP_PASSWORD " \
"must be set!")
return False
aaisp = AAISP(username, password)
for service_id in aaisp.services():
tx_rate = aaisp.tx_rate(service_id, AAISP.FORMAT_MBITS)
rx_rate = aaisp.rx_rate(service_id, AAISP.FORMAT_MBITS)
usage_rem = aaisp.usage_remaining(service_id, AAISP.FORMAT_GBYTES)
usage_used = aaisp.usage_used(service_id, AAISP.FORMAT_GBYTES)
login = aaisp.login(service_id)
print(f"Login: {login}")
print(f" Download: {tx_rate} Mbit/s")
print(f" Upload: {rx_rate} Mbit/s")
print(f" Remaining: {usage_rem} GB")
print(f" Used: {usage_used} GB\n")
# --------------------------------------------------------------------------- #
if __name__ == '__main__':
main()