Skip to main content

An asynchronous Twitter API client for Python 3.6+

Project description

https://codecov.io/gh/odrling/peony-twitter/branch/master/graph/badge.svg Documentation Status

Installation

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
>>> tokens = oauth_dance(YOUR_CONSUMER_KEY, YOUR_CONSUMER_SECRET)
>>> 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,
                     consumer_secret=YOUR_CONSUMER_SECRET,
                     access_token=YOUR_ACCESS_TOKEN,
                     access_token_secret=YOUR_ACCESS_TOKEN_SECRET)

# this is a coroutine
req = client.api.statuses.update.post(status="I'm using Peony!!")

# run the coroutine
loop.run_until_complete(req)

Documentation

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.

Contributing

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.

Tests

To run the tests run:

make

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:

tox

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

peony-twitter-2.1.2.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

peony_twitter-2.1.2-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

Details for the file peony-twitter-2.1.2.tar.gz.

File metadata

  • Download URL: peony-twitter-2.1.2.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for peony-twitter-2.1.2.tar.gz
Algorithm Hash digest
SHA256 8a4b29919df070e387234ed71be3b0efa7068c9caf87fcc17e581320f6748453
MD5 59c8e7303fb4a1afbb9832764f664acc
BLAKE2b-256 72936ba24dea212c87cf846f62dc766dd8eb6ef3e0384528676889c824b507ec

See more details on using hashes here.

File details

Details for the file peony_twitter-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: peony_twitter-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 37.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for peony_twitter-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0bcd8ed166107c40771d31a86b98fb36443ed262fb2fabd0cdc746d4b6aa36ca
MD5 9c82dd01e9220f8c4fa1cc3d55fd0496
BLAKE2b-256 fb923d6265e1c42e3031424bbb4c4ea3877a8efbbd1a64af0f1168900828ca58

See more details on using hashes here.

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