You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
odrling c0b50a7b8f
help black format strings
2 weeks ago
.github/workflows [actions] only run mypy on peony directory 7 months ago
docs black formatting 2 weeks ago
examples help black format strings 2 weeks ago
peony help black format strings 2 weeks ago
tests black formatting 2 weeks ago
.gitignore black formatting 2 weeks ago
.pre-commit-config.yaml black formatting 2 weeks ago
LICENSE add a proxy option, update readme and license 6 years ago setup tox 5 years ago
Makefile makefile: only run flake8 on modified files 6 months ago
README.rst black formatting 2 weeks ago
dev_requirements.txt install types-setuptools for CI 8 months ago
extras_require.txt install python-magic-bin on Windows when installing python-magic 8 months ago
mypy.ini add mypy to github CI 8 months ago
pytest.ini tests: set timeout in pytest.ini 1 year ago
requirements.txt Update requirements.txt 2 years ago
setup.cfg black formatting 2 weeks ago black formatting 2 weeks ago
tests_requirements.txt install types-setuptools for CI 8 months ago
tox.ini tests: set timeout in pytest.ini 1 year ago


Asynchronous Twitter API client for Python 3.6+

.. image::

.. image::
:alt: Documentation Status

.. image::


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.

.. _Advanced installation:

Authorize your client

You can use ``peony.oauth_dance`` to authorize your client:

.. code-block:: python

>>> 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`_

.. code-block:: python

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

.. _Twitter's application management page:

.. _Authorize your client: #authorize-your-client


Read `Peony's documentation`_ on Read The Docs.

There is a `#peony`_ channel on the `Libera IRC network`_ for support and
discussion about Peony.
You can use `Libera's webchat`_ to connect to this channel from your web browser.

.. _Peony's documentation:
.. _#peony: irc://
.. _Libera IRC network:
.. _Libera's webchat:


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:

.. code-block:: bash


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).

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

.. code-block:: bash