This program automates the generation of an internal CapRadio spreadsheet containing cut numbers for NPR funding credits.
- Automatically downloads pertinent NPR funding credit spreadsheets.
- Outputs an Excel Spreadsheet as well as to Google Sheets
- Integrates with Slack workspace in the form of a bot to trigger the funding credit update. This can be used by anyone with access to the channel with the bot.
- Ubuntu Server 20.04
- Python 3.8
- Credentials to nprstations.org
- Google Service Account (for sheets integration)
- Slack Workspace and Account (for Slack bot Integration)
These Environment variables should be stored in a .env file in ./modules/config/
USER_NAME={Username}PASSWORD={Password}NPR_ROOT={Root_URL}LOGIN_PAGE={Login_URL}CREDIT_PAGE={Funding_Credits_Page_URL}
SLACK_TOKEN={Token_from_Legacy_API}
SPREADSHEET_ID={Google_Sheets_ID_String}TEST_ID={Google_Sheets_ID_String}
-
Run
environ$ . environ- This will create a python virtual environment and install libraries found in
requirements.txt
- This will create a python virtual environment and install libraries found in
-
Create a
.envfile in ./modules/config/ and populate with credentials listed above in the Environment Variables section. -
For Google Sheets integration:
- Create a Spreadsheet in Google Sheets
- Get the targeting string from the sheet url and enter it into the
.envfile. - The first time you run the program it will ask you to authenticate your Google account.
-
For Slack Integration:
- Create a Classic Slack App (I know, I know...it's a legacy API)
- After completing this process, enter the API token into the
.envfile.
-
Download sample
news.xlsandnewscast.xlsspreadsheets from nprstations.org, and modify tests to match. -
Run tests
$ . fund tests
- Simply execute the
fundscript. This has been provided at the top level directory for your convenience.$ . fund
- Execute
fundwith abotflag$ . fund bot - To trigger a new update
@mentionthe bot's name along with one of the trigger strings. - The bot will notify you when the update is complete.