Skip to main content

An asynchronous Twitter API client for Python 3.5+

Project description Documentation Status


To install this module simply run:

pip install peony-twitter[all]

This will install all the modules required to make peony run out of the box. You might feel like some of them are not fit for your needs. Check Advanced installation for more information about how to install only the modules you will need.

Authorize your client

You can use peony.oauth_dance to authorize your client:

>>> from peony.oauth_dance import oauth_dance
>>> from peony import PeonyClient
>>> client = PeonyClient(**tokens)

This should open a browser to get a pin to authorize your application.

Getting started

You can easily create a client using the class PeonyClient. Make sure to get your api keys and access tokens from Twitter’s application management page and/or to Authorize your client

import asyncio

# NOTE: the package name is peony and not peony-twitter
from peony import PeonyClient

loop = asyncio.get_event_loop()

# create the client using your api keys
client = PeonyClient(consumer_key=YOUR_CONSUMER_KEY,

# this is a coroutine
req ="I'm using Peony!!")

# run the coroutine


Read Peony’s documentation.


Every kind of contribution is appreciated.

If you find a bug please start an issue and if you’re very motivated you can create a pull request.

If you have a suggestion you can also start an issue and create a pull request if you managed to make it work.


To run the tests run:

make test

The first time this command is run it will install all the dependencies which can take a bit of time.

The tests include a code style test. The code style is mostly PEP8, the only exception so far being long urls included in docstrings and some imports that are not at the top of the file (because they can’t be there).

To resolve the most trivial errors you can run:

make format

Note that running make is equivalent to running make format && make test

You can also use tox to run the tests, a configuration file is provided:


Project details

Download files

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

Files for peony-twitter, version 1.1.7
Filename, size File type Python version Upload date Hashes
Filename, size peony_twitter-1.1.7-py3-none-any.whl (35.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size peony-twitter-1.1.7.tar.gz (71.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page