This script allows you to send a tweet using the new X API (formerly known as Twitter) with Python and Tweepy. Detailed description can be found here.
- Python 3.x installed.
- A .env file containing your X API keys.
- tweepy and python-dotenv
- Clone this repository:
git clone [email protected]:skillsharer/twitter-api.git
- Navigate to the directory:
cd twitter-api
- Install the required packages:
pip install tweepy python-dotenv
- Set up your .env file in the root of the directory with the following format:
CONSUMER_KEY=YOUR_CONSUMER_KEY
CONSUMER_SECRET=YOUR_CONSUMER_SECRET
ACCESS_TOKEN=YOUR_ACCESS_TOKEN
ACCESS_TOKEN_SECRET=YOUR_ACCESS_TOKEN_SECRET
BEARER_TOKEN=YOUR_BEARER_TOKEN
Run the script using:
python tweet.py
The script will then send a "Hello, World!" tweet using the provided API keys.