Skip to main content

jetblack-tweeter

A Python 3.8 asyncio twitter client.

This Twitter client is designed to support arbitrary HTTP clients. There is currently support for bareClient and aiohttp.

Status

This is work in progress, but functional.

There is currently limited support for streaming, statuses and accounts. Only the 1.1 api is currently implemented.

Installation

Install with pip, specifying the HTTP backend you wish to use.

For bareClient:

pip install jetblack-tweeter[bareclient]

For aiohttp:

pip install jetblack-tweeter[aiohttp]

Usage

Here is an example:

import asyncio
import os

from jetblack_tweeter import Tweeter
from jetblack_tweeter.clients.bareclient import BareTweeterSession

# Get the secrets from environment variables.
APP_KEY = os.environ["APP_KEY"]
APP_KEY_SECRET = os.environ["APP_KEY_SECRET"]
ACCESS_TOKEN = os.environ["ACCESS_TOKEN"]
ACCESS_TOKEN_SECRET = os.environ["ACCESS_TOKEN_SECRET"]


async def main():
    tweeter = Tweeter(
        BareTweeterSession(),
        APP_KEY,
        APP_KEY_SECRET,
        # Optional for user authentication.
        access_token=ACCESS_TOKEN,
        access_token_secret=ACCESS_TOKEN_SECRET
    )

    user_timeline = await tweeter.statuses.user_timeline()
    print(user_timeline)

    account_settings = await tweeter.account.settings()
    print(account_settings)

    account_verify_credentials = await tweeter.account.verify_credentials()
    print(account_verify_credentials)

    # Watch the random sampling of tweets chosen by twitter
    async for tweet in tweeter.stream.sample():
        print(tweet)

    # Stream tweets which have the tag "#python" from New York
    # and San Francisco.
    async for tweet in tweeter.stream.filter(
            track=['#python'],
            locations=[
                ((-122.75, 36.8), (-121.75, 37.8)),
                ((-74, 40), (-73, 41))
            ]
    ):
        print(tweet)

    result = await tweeter.statuses.update('Hello from jetblack-tweeter')
    print(result)

if __name__ == '__main__':
    asyncio.run(main())

Metadata

Release files for jetblack-tweeter 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jetblack-tweeter 0.10.0
File Size Uploaded Provenance Actions
jetblack-tweeter-0.10.0.tar.gz 20.7 kB Without provenance Details for jetblack-tweeter-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jetblack-tweeter 0.10.0
File Interpreter ABI Platform Actions
jetblack_tweeter-0.10.0-py3-none-any.whl Python 3 none any Details for jetblack_tweeter-0.10.0-py3-none-any.whl

Total release size: 47.6 kB

Release files / jetblack-tweeter-0.10.0.tar.gz

Download URL jetblack-tweeter-0.10.0.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
177fac1acb87484d5a43368c3dc5de4992de2addbdaad3e88e7e1fbc3c72b0fa
BLAKE2b-256 checksum
How to use checksums
f1b5bdd303e01289ec0e945cbc250f5a2577af2dcb88cb09bcfb89974c0cc58d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.11 Darwin/21.6.0

Release files / jetblack_tweeter-0.10.0-py3-none-any.whl

Download URL jetblack_tweeter-0.10.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c179a4609980c6465e891395dc5a3fbb62bdf2deec7fec5c35619ec8b448952
BLAKE2b-256 checksum
How to use checksums
e2f2d9ae8ffe40465ddf93f04f9cfb2ce267834f4fdb1c097f2053d171e70f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.11 Darwin/21.6.0

Security for jetblack-tweeter 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page