Having a RUFF morning? This project is a simple Python application that uses Google's Gemini API to generate short inspirational quotes and posts them on Twitter along with random dog images. The bot is perfect for bringing a daily dose of positivity and cuteness to your Twitter feed!
- π Fetches a random dog image from the Dog CEO's Dog API.
- π Generates a short inspirational quote with a dog-related pun using Google's Gemini API.
- π¦ Posts the image and quote as a tweet on Twitter using Tweepy.
To run this project, ensure you have the following:
- π Python 3.9 or higher installed.
- π€ Twitter Developer account with API keys and access tokens.
- π A Google Gemini API key. You can get one from Google AI Studio.
-
π₯ Clone the Repository
Clone the repository to your local machine:
git clone https://github.com/yourusername/dog-quote-tweeter-bot.git cd dog-quote-tweeter-bot -
π¦ Install Dependencies
Install the required Python packages using pip:
pip install tweepy requests shutil google-generativeai
-
π Set Up Your API Keys
-
Obtain your Twitter API keys and access tokens from the Twitter Developer portal and set them in the script.
-
Obtain your Gemini API key from Google AI Studio and configure it in the
quote_generator.pyscript. -
It is recommended to use environment variables for API keys to ensure security:
On Unix-like systems (Linux, macOS):
export API_KEY="your_gemini_api_key" export TWITTER_CONSUMER_KEY="your_consumer_key" export TWITTER_CONSUMER_SECRET="your_consumer_secret" export TWITTER_ACCESS_TOKEN="your_access_token" export TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"
On Windows:
set API_KEY="your_gemini_api_key" set TWITTER_CONSUMER_KEY="your_consumer_key" set TWITTER_CONSUMER_SECRET="your_consumer_secret" set TWITTER_ACCESS_TOKEN="your_access_token" set TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"
-
-
βΆοΈ Run the ScriptTo post a tweet with a random dog image and an inspirational quote, run:
python tweeter_bot.py
Ensure that your API keys are correctly set up before running the script.
-
π€ Output
After running the script, a tweet will be posted on the authenticated Twitter account with a dog image and an inspirational quote.
dog-quote-tweeter-bot/
β
βββ quote_generator.py # Script for generating inspirational quotes using Gemini API
βββ tweeter_bot.py # Main script for fetching images and posting tweets
βββ README.md # Project documentation
βββ requirements.txt # List of Python dependencies
Below is an example of what might be posted as a tweet:
Image: [A random dog picture]
Text: "Start your day pawsitively! Remember, no mutt-er what, you can fetch your dreams! πΆ"
You can view an example live working project implementation on Twitter: @ca49324
If you would like to contribute to this project, please fork the repository and submit a pull request with your changes. Make sure to follow the established coding style and include comments where necessary.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or suggestions about this project, feel free to contact me at [email protected].