File: persisting_a_consensus.py

package info (click to toggle)
python-stem 1.8.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,152 kB
  • sloc: python: 33,747; java: 312; makefile: 124; sh: 14
file content (8 lines) | stat: -rw-r--r-- 328 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
from stem.descriptor import DocumentHandler
from stem.descriptor.remote import DescriptorDownloader

downloader = DescriptorDownloader()
consensus = downloader.get_consensus(document_handler = DocumentHandler.DOCUMENT).run()[0]

with open('/tmp/descriptor_dump', 'w') as descriptor_file:
  descriptor_file.write(str(consensus))