Minimal CLI to tweet via Twitter API.
Project description
twtr
Setup
- 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
- Add these lines to your
~/.zshrcor~/.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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file twtr-0.1.0.tar.gz.
File metadata
- Download URL: twtr-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156ab9298401d00b01ee3d015f22275e2d26d949259caf820bfb1f455bef408a
|
|
| MD5 |
00809ea76fa1ef86e35e62445f5a77e8
|
|
| BLAKE2b-256 |
7b2337bea9bccca0ad659a555caeced616af3c630b31c2e72d3ca29e2c8d4fc3
|
File details
Details for the file twtr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: twtr-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c940d1c9147e7e5bb6461e80f6fa32dc792739d3ef7111ac02cbe741d69b5b5c
|
|
| MD5 |
f4c762b28b299be3ae740ca6ac21b38b
|
|
| BLAKE2b-256 |
b6321c69f2736fbd11644c48ba367cb3a0925cd47147ffbdc85aa0e331a9bac7
|