This project is a simple Twitter bot that tweets a message at sunrise in a specified city.
- Clone or download the project files.
- Create a virtual environment for the project and install the necessary packages:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Create a new Twitter app at https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api
- Generate the necessary API keys and access tokens for your app.
- Rename the
config_template.yml
file toconfig.yml
and fill in the necessary values with your API keys and access tokens. - Set the city you want the sunrise time for in the
config.yml
file. A list of supported cities can be found at https://sffjunkie.github.io/astral/#cities. - Set the content of your tweet in the
config.yml
file. You can use placeholders (e.g.{1}
,{2}
, etc.) in your tweet content to insert dynamic values. - If you want to use placeholders in your tweet content, edit the
placeholders
list in thetweet_parameters.py
file with the values you want to use. - Run the
main.py
file to start the bot.
You can customize the following parameters in the config.yml
file:
consumerKey
: Your Twitter API consumer key (also known as the API key).consumerSecret
: Your Twitter API consumer secret (also known as the API secret key).accessToken
: Your Twitter API access token.accessTokenSecret
: Your Twitter API access token secret.city
: The city you want the sunrise time for. A list of supported cities can be found at https://sffjunkie.github.io/astral/#cities.tweetContent
: The content of your tweet. You can use placeholders (e.g.{1}
,{2}
, etc.) in your tweet content to insert dynamic values.
If you want to use placeholders in your tweet content, you can customize the placeholders
list in the tweet_parameters.py
file with the values you want to use to replace the placeholders.
- Make sure you filled in the necessary values in the
config.yml
file. - If you get an error message saying that the
config.yml
file is missing, make sure you renamed theconfig_template.yml
file toconfig.yml
. - If you get an error 403 when trying to access the Twitter API, make sure you filled in the correct API keys and access tokens in the
config.yml
file. and that you have write access to the Twitter account you are trying to tweet from.