txtorcon
Twisted-based Tor controller client, with state-tracking and configuration abstractions. https://txtorcon.readthedocs.org https://github.com/meejah/txtorcon
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 txtorconuv
uv add txtorconpoetry
poetry add txtorconInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
stemStem is a Python controller library for…
copyleft · top 15,000 on PyPI
ircProvides a low-level, event-driven IRC protocol…
permissive · top 15,000 on PyPI
treqtreq is a high-level HTTP client library for…
permissive · top 15,000 on PyPI
TwistedTwisted is an event-driven networking framework…
permissive · top 5,000 on PyPI
ldaptorLdaptor is a pure-Python LDAP client library…
permissive · top 5,000 on PyPI
pytest-twistedA pytest plugin that enables testing of…
permissive · top 15,000 on PyPI
cirqCirq is a Python framework for writing,…
permissive · top 15,000 on PyPI
py-builder-relayer-clientA Python client library for submitting…
permissive · top 15,000 on PyPI
pynput-robocorp-forkControls and monitors mouse and keyboard input…
copyleft · top 15,000 on PyPI
os-kenos-ken is a component-based software defined…
permissive · top 15,000 on PyPI