Skip to main content

Python wrapper for the OnionOO tor status API

Project description


A comprehensive pure-Python wrapper for the OnionOO Tor status API, with memcached support to cache queried data.

Installing OnionPy

You can install onion-py manually by doing the following (requires setuptools!)::

git clone
cd onion-py
#run tests if desired
PYTHONPATH=. python bin/ test
sudo python install

For the optional memcached support, install pymemcache and six::

sudo pip install six
sudo pip install

The package is also on [Pypi](

**Beware**: <del>OnionPy has been developed and tested exclusively with Python 3. Please let Python 2 rest in peace forevermore.</del> OnionPy is compatible with Python 2.7 upwards.


>>> from onion_py.manager import Manager
>>> from onion_py.caching import OnionSimpleCache
>>> manager = Manager(OnionSimpleCache())
>>> s = manager.query('summary', limit=4)
>>> s.relays[0].fingerprint
>>> s.relays[0].nickname

Accepted Queries
Summary, details, bandwidth, weights, clients, uptime

>>> s = manager.query('summary', limit=4)
>>> s = manager.query('details', limit=4)
>>> s = manager.query('bandwidth', limit=4)
>>> s = manager.query('weights', limit=4)
>>> s = manager.query('clients', limit=4)
>>> s = manager.query('uptime', limit=4)


BSD 3-clause. See LICENSE.
Portions of this work obviously belong to to OnionOO and therefore the Tor Project. See ONIONOO-LICENSE.

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

OnionPy-0.5.0.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distributions

OnionPy-0.5.0-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

OnionPy-0.5.0-py2-none-any.whl (11.2 kB view hashes)

Uploaded Python 2

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