Skip to content

⛈ Is the Weather Weird? A Twitter bot for istheweatherweird.com, keeping an eye on various cities

Notifications You must be signed in to change notification settings

istheweatherweird/itww_bot

Repository files navigation

⛈ Is the Weather Weird?

A Twitter bot for istheweatherweird.com, keeping an eye on various cities.

Uses Python, tweepy, and Github Actions. S/o to this post by Emily Cain for the guiding method. Current data is pulled from the National Weather Service API, and we run a check to make sure we have observations at least every 4 hours. For more methodolgy documentation, check out istheweatherweird.com.

This is a bot by Bea Malsky. istheweatherweird.com was made by Jonah Bloch-Johnson and Eric Potash.

Requirements

Deployment

The main script in this app is bot.py, and it is triggered hourly by the cron in .github/workflows/tweet.yml.

Running the app locally

To get started, run the following from your terminal:

  1. Clone this repository and cd into your local copy.
git clone [email protected]:istheweatherweird/itww_bot.git
cd itww_bot
  1. Switch the LOCAL_DEVELOPMENT variable in bot.py to True

  2. Rename secrets_example.py to secrets.py:

mv secrets_example.py secrets.py
  1. Run the app locally!

To preview your tweet(s) locally, go into bot.py and set LOCAL_DEVELOPMENT to True. Then, run:

docker-compose build
docker-compose run --rm app python bot.py

If successful, you'll see generated tweets in the terminal.

To run tests manually:

docker-compose run --rm app pytest

Setting up a bot for a new location

Follow these steps to start a Twitter bot for one of the locations in the stations spreadsheet:

  1. Start a new Twitter account for your desired city. Give it a cover image, profile picture, and bio.
  2. Visit https://developer.twitter.com/en/apps, and go through the steps there to Create a New App for your new account.
  3. Once you've completed Twitter's application, you'll be prompted to create Consumer API keys and an Access Token and Access Token Secret. Add those to your local secrets.py file with the city's ICAO code as a prefix. Also add these to .github/workflows/tweet.yml and as repository secrets here.
  4. Change the cities variable in bots.py to include the name of your city. This should match the way it's written in the station spreadsheet's place column.

That's it! Your bot should now tweet every day at 6pm local time!

About

⛈ Is the Weather Weird? A Twitter bot for istheweatherweird.com, keeping an eye on various cities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published