A simple CLI tool to tweet from your terminal
Project description
TermTweet
A simple, powerful Python script to tweet directly from your terminal or IDE. Perfect for developers who want to share code updates, project milestones, or quick thoughts while working on their projects.
✨ Features
- 🚀 Tweet from terminal - Post text tweets directly from command line
- 📸 Image support - Attach images by providing file path
- 🔐 Secure authentication - Environment variables keep credentials safe
- ⚡ Easy setup - Interactive setup script guides you through configuration
- 🛠️ Developer-friendly - Works from any directory, perfect for coding sessions
- 📝 Input validation - Automatic tweet length checking (280 chars max)
📋 Prerequisites
- Python 3.8 or higher
- Twitter Developer Account with API v2 access
🚀 Installation
Option 1: Install from PyPI (Recommended)
# Install globally (like npm install -g)
pip install termtweet
# Run setup
termtweet --setup
Option 2: Install from Source
# Clone the repository
git clone https://github.com/yourusername/termtweet.git
cd termtweet
# Install in development mode
pip install -e .
# Run setup
termtweet --setup
Option 3: Manual Setup (Advanced)
# Clone and install dependencies
git clone https://github.com/yourusername/termtweet.git
cd termtweet
pip install -r requirements.txt
# Configure credentials manually
cp .env.example .env
# Edit .env with your Twitter API credentials
📖 Usage
Basic tweet:
termtweet "Hello from the terminal! #coding"
Tweet with image:
termtweet "Check out this cool screenshot!" --image ./screenshot.png
Short options:
termtweet "Quick tweet!" -i image.png
Test your setup:
termtweet --test
Run setup:
termtweet --setup
💡 Examples
# Share coding progress
termtweet "Just implemented a new feature! 🚀 #programming"
# Post with screenshot
termtweet "Here's my app's new UI:" --image ./screenshots/new_ui.png
# Quick updates
termtweet "Pushed to GitHub. Time for coffee! ☕ #devlife"
# During development
termtweet "Fixed that pesky bug! Now onto the next challenge 🎯"
# From any project directory
termtweet "Working on something awesome!" -i screenshot.png
🔧 Twitter API Setup
Step 1: Create Twitter Developer Account
- Go to Twitter Developer Portal
- Sign up for a developer account if you don't have one
- Create a new project/app or use an existing one
Step 2: Configure App Permissions (CRITICAL)
This is the most important step - without it, tweets will fail!
- In your app settings, go to "App permissions"
- Change permissions from "Read" to "Read and write"
- Change "Type of App" to "Web App, Automated App or Bot"
- Fill in the required "App info":
- Callback URI / Redirect URL:
http://localhost - Website URL: Your website or
https://github.com/yourusername - Organization name: Your name or project name (optional)
- Callback URI / Redirect URL:
Step 3: Generate API Tokens
- Go to "Keys and tokens" section
- Generate/copy these credentials:
- API Key (Consumer Key)
- API Secret (Consumer Secret)
- Access Token
- Access Token Secret
- Bearer Token
Step 4: Configure TermTweet
Use the interactive setup:
termtweet --setup
Or manually create ~/.termtweet/.env with:
TWITTER_API_KEY=your_api_key_here
TWITTER_API_SECRET=your_api_secret_here
TWITTER_ACCESS_TOKEN=your_access_token_here
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret_here
TWITTER_BEARER_TOKEN=your_bearer_token_here
Step 5: Test Your Setup
termtweet --test
termtweet "Hello World! #TermTweet"
⚠️ Common Issues & Solutions
| Problem | Solution |
|---|---|
| "403 Forbidden" | Change app permissions to "Read and write" |
| "Authentication failed" | Regenerate tokens after permission change |
| "Missing credentials" | Run termtweet --setup |
| "Tweet too long" | Keep under 280 characters |
🔒 Security & Best Practices
- Never commit
.envfiles to version control - Keep API credentials secure and private
- Regenerate tokens if compromised
- Use environment variables for sensitive data
🐛 Troubleshooting
| Issue | Solution |
|---|---|
| "Missing Twitter API credentials" | Run python setup.py or check .env file |
| "403 Forbidden" | Ensure app has "Read and Write" permissions |
| "Authentication failed" | Verify all credentials in .env are correct |
| "Image file not found" | Check image path and ensure file exists |
| "Tweet too long" | Keep tweets under 280 characters |
🤝 Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built with Tweepy - Python Twitter API library
- Inspired by developers who tweet from the terminal
Happy tweeting from your terminal! 🐦
Project details
Release history Release notifications | RSS feed
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 termtweet-1.0.0.tar.gz.
File metadata
- Download URL: termtweet-1.0.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2f02acf72dd9a433baa5f4c7362a0249fd2285ddda1e772de12a62934a70cf8
|
|
| MD5 |
960fa3ddda6e7388448885fcd48f38f5
|
|
| BLAKE2b-256 |
294307ee019180c6e529b23a93303876cecf3ae73b5cd78dead9a1eebfc12f9f
|
File details
Details for the file termtweet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: termtweet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2ddd75cb2fcd8861b50ea60be403d6f7adbd710a0ef4da6c8b7fa1c147775ec
|
|
| MD5 |
c132028773acef6f3bd70fc484b6bd08
|
|
| BLAKE2b-256 |
a1d963a9cad0658209fcedb9c7f0bb4f4e46114cde5014ec9a546ba6ffdd125b
|