skillfed

txtorcon

Twisted-based Tor controller client, with state-tracking and configuration abstractions. https://txtorcon.readthedocs.org https://github.com/meejah/txtorcon

txtorcon v26.6.0 695.1K downloads/30d#5,310 on PyPI260
Permissive license MIT Active released

What it is and what it does

txtorcon implements the Tor control specification for Python, allowing programs to connect to a running Tor instance and issue commands asynchronously. It abstracts Tor's control protocol into Python objects representing circuits, relays, and configuration, making it practical to embed Tor functionality into larger applications.

Typical usage involves connecting to a local or remote Tor control socket, then issuing commands: fetching live stream updates, building circuits through specific relays, reading and modifying Tor configuration, or launching hidden services. The library integrates with endpoint systems, so Tor-routed connections can be used transparently in servers and clients.

Use it for:

  • Monitor Tor relay and stream activity in real time from a Python event loop.
  • Automate onion service deployment and management via the control protocol.
  • Create a Tor controller tool that tracks circuit state and relay information.
  • Build a proxy or client that routes traffic through Tor circuits programmatically.
  • Integrate Tor anonymity into existing Python applications.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

txtorcon is a client library for controlling and monitoring Tor instances via the Tor control protocol, enabling Python programs to manage circuits, streams, relays, and onion services.

Yes, if you need to control or monitor Tor from Python. The library is actively maintained, has no known vulnerabilities, installs with low friction, and is MIT-licensed. Not relevant for applications that do not need direct Tor control.

Install

txtorcon on PyPI

pip

pip install txtorcon

uv

uv add txtorcon

poetry

poetry add txtorcon

Installing txtorcon

Before you install

Low install friction; pure Python wheel with no compiled dependencies. Actively maintained as of 2026-06-01.

License in practice

MIT-licensed under permissive terms, allowing use in commercial and proprietary projects with minimal restrictions.

Quickstart

pip install txtorcon

import txtorcon

tor = await txtorcon.connect(reactor)
print(f"Connected to Tor {tor.version}")

Requires a running Tor daemon accessible via control socket; Python 3.8+ required.

Verify before relying

  • Whether Automat and Twisted are explicitly listed as runtime dependencies in package metadata (description mentions them but deps.runtime is empty).
  • Specific version constraints for Twisted or Automat compatibility.
  • Whether the example code in the description excerpt is representative of typical usage patterns.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 74 days since the last release
Last repo commit
First released
Downloads 695,097/month — #5,310 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: txtorcon-26.6.0-py3-none-any.whl

Keywords: python, twisted, tor, tor controller

Development Status :: 4 - BetaFramework :: TwistedIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: InternetTopic :: Internet :: Proxy ServersTopic :: SecurityTopic :: Software Development :: Libraries :: Python Modules

Tags

tor controller client pythontor circuit managementtor control protocolonion service automationtor state trackingtor event monitoringtor relay monitoring
tor-integrationanonymity

More Python Modules packages