-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_list_residential_subusers.py
More file actions
31 lines (23 loc) · 932 Bytes
/
02_list_residential_subusers.py
File metadata and controls
31 lines (23 loc) · 932 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
"""
List residential sub-users for both proxy types.
Each sub-user has a `proxy_password` that you use to authenticate against
the residential relays. The username (with country/region/city targeting)
is composed client-side; see 04_generate_residential_proxies.py.
"""
from proxyshard import ProxyshardClient
def fmt_gb(bytes_: int) -> str:
return f"{bytes_ / 1024 ** 3:.2f} GB"
def main() -> None:
client = ProxyshardClient()
for proxy_type in ("standart", "premium"):
users = client.residential_subusers(proxy_type=proxy_type, limit=20)
print(f"\n=== {proxy_type.upper()} ({len(users)} sub-users) ===")
for u in users:
spent = fmt_gb(u["data_spent"])
total = fmt_gb(u["data"])
print(
f" id={u['user_id']} name={u['first_name']!r:<20} "
f"used {spent} / {total}"
)
if __name__ == "__main__":
main()