Sunday 15 August 2010

python - How read the bandwidth limit parameter from Tor with Stem -



python - How read the bandwidth limit parameter from Tor with Stem -

how 1 read tor parameter bandwidth limit using stem? i've looked around theapi , could'n find method or getinfo parameter such task.

assuming mean maximum bandwidth you've configured relay it's...

from stem.control import controller stem.util.str_tools import get_size_label controller.from_port() controller: controller.authenticate() bw_rate = get_size_label(int(controller.get_conf('bandwidthrate', '0'))) bw_burst = get_size_label(int(controller.get_conf('bandwidthburst', '0'))) print "you're configured relay @ %s/s, bursts %s/s" % (bw_rate, bw_burst)

... example...

% python scrap.py you're configured relay @ 1 gb/s, bursts 1 gb/s

the git repository has new get_effective_rate() method takes additional configuration attributes account.

python tor relay

No comments:

Post a Comment