Skip to main content

Minimalistic asyncio-based Tor Controller

Project description

Minimalistic Tor Controller

Minimalistic asyncio-based Tor controller.

How to use:

    from mintc import TorController

    tc = TorController('127.0.0.1:9051')
    try:
        await tc.start()
        await tc.authenticate('password')
        async for circuit in tc.get_circuits():
            print(circuit)
    finally:
        await tc.stop()

Or:

    async with TorController('127.0.0.1:9051') as tc:
        await tc.authenticate('password')
        async for circuit in tc.get_circuits():
            print(circuit)

The format of control port argument passed to the constructor is identical to ControlPort from torrc.

Only small subset of commands is implemented so far.

This controller neither does nor will implement auto reconnect. It's the user's responsibility to catch any exceptions and re-run the entire async with TorController... code block or restart the controller with tc.restart() and start over again from tc.authenticate().

All response parsing is very minimalistic. E.g. date/time strings are not parsed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mintc-0.0.4.tar.gz (11.8 kB view hashes)

Uploaded Source

Built Distribution

mintc-0.0.4-py3-none-any.whl (12.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page