Sends a Slack message containing information about today's weather forecast.
You'll need to create a file called config.py
containing your Slack API token (which can be obtained from the Slack API page) and the desired user name for your bot. These must be named SLACK_TOKEN
and SLACK_USER
, respectively.
The configuration file must also contain an OpenWeatherMap API token (you'll have to sign up for OpenWeatherMap) and the name of the city whose weather you're interested in (this city can by overridden on the command line). These must be named OWM_TOKEN
and DEFAULT_CITY
.
For example:
SLACK_TOKEN = 'XXXX-XXXX-XXXX-XXXX-XXXX'
SLACK_USER = 'BotName'
OWM_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
DEFAULT_CITY = 'Winnipeg'
- requests
- slackutils
- Currently uses icons provided by OpenWeatherMap, but support for a set of custom icons would be great.
None
Information about Slack is available on their website. Information about the Slack API is available here.
Information about OpenWeatherMap is available on their website. Information about their API is available here.
This was BCJ's idea.
Written by Gem Newman. Website | GitHub | Twitter
This work is licensed under Creative Commons BY-SA 4.0.
Remember: GitHub is not my CV.