Skip to main content

Minimal CLI to tweet via Twitter API.

Project description

twtr

Setup

  1. Make a free account and project at developer.x.com and get the following keys:
  • Bearer Token
  • Consumer Key
  • Consumer Secret
  • Access Token
  • Access Token Secret

  1. Add these lines to your ~/.zshrc or ~/.bashrc:

December 2025 update: this is honestly bad practice, so I recommend putting your environment variables in a separate .env file and then exporting that. Nevertheless, you need to somehow expose these keys to the environment.

export TWEEPY_BEARER_TOKEN="<your_bearer_token>"
export TWEEPY_CONSUMER_KEY="<your_consumer_key>"
export TWEEPY_CONSUMER_SECRET="<your_consumer_secret>"
export TWEEPY_ACCESS_TOKEN="<your_access_token>"
export TWEEPY_ACCESS_TOKEN_SECRET="<your_access_token_secret>"

Then reload your config:

source ~/.zshrc

or

source ~/.bashrc

Usage

Install from PyPI with uv:

uv tool install twtr

Then tweet from the CLI:

twtr "your tweet here"

Development

Set up the development environment:

uv sync

Run the package locally for testing:

# Using the entry point script
uv run twtr "your tweet here"

# Or as a Python module
uv run python -m twtr.cli "your tweet here"

Structure

.
├── LICENSE
├── README.md
├── keys.png
├── pyproject.toml
├── twtr
│   ├── __init__.py      # Public API (expose main functions/classes)
│   └── cli.py           # CLI entry point (separate from core logic)
└── uv.lock

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

twtr-0.1.4.tar.gz (95.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twtr-0.1.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file twtr-0.1.4.tar.gz.

File metadata

  • Download URL: twtr-0.1.4.tar.gz
  • Upload date:
  • Size: 95.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for twtr-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ef56d21600e8c7990d1d0e281b866c91c0694870f1e827fb4f3ebb95a26c142e
MD5 d2ac59ec795a74abf2e497e913c8c208
BLAKE2b-256 c8d65c8a78d851b0874ebb0ce4a976ccb15e4192695897545e849b46f305564a

See more details on using hashes here.

File details

Details for the file twtr-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: twtr-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for twtr-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d53795089ad8881f48156a736b8da0fb93d4012b05dcc3bb8e5f9af47954c0e0
MD5 1fb88476d24c3039a92ad78d279b572d
BLAKE2b-256 606ffd27f6f00f0d091099fcf875d5b7255c9a4c1eb28039eaeb736e5169f64a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page