-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_circuits.py
More file actions
34 lines (29 loc) · 1.09 KB
/
get_circuits.py
File metadata and controls
34 lines (29 loc) · 1.09 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
from anyone_protocol_sdk import Control, Config, Process
# Create a configuration
config = Config(
auto_terms_agreement=True
)
# Initialize and start
anon = Process.launch_anon(anonrc_path=config.to_file())
client = Control.from_port()
try:
client.authenticate()
circuits = client.get_circuits_with_relay_info_and_country()
for circuit in circuits:
print(f"Circuit ID: {circuit['id']}")
print(f" Time Created: {circuit['created']}")
print(f" Status: {circuit['status']}")
print(f" Purpose: {circuit['purpose']}")
print(" Path:")
for relay in circuit['relays']:
print(f" Fingerprint: {relay['fingerprint']}")
print(f" Nickname: {relay['nickname']}")
print(f" Address: {relay['address']}")
print(f" Country: {relay['country']}")
print(f" ORPort: {relay['or_port']}")
print(f" Flags: {', '.join(f.name for f in relay['flags'])}")
print(f" Bandwidth: {relay['bandwidth']}")
print()
finally:
client.close()
anon.stop()