The Daily Dose News App is a Flask application that fetches news articles from an API, summarizes them using the OpenAI GPT-3.5 Turbo model, and sends out a daily email digest at 7 AM CST.
- Fetches news articles using the NewsData API
- Summarizes news articles with OpenAI GPT-3.5 Turbo model
- Schedules and sends a daily email digest with Mailchimp
- Clone the repository:
git clone https://github.com/yourusername/daily_dose_news_app.git
- Change into the project directory:
cd daily_dose_news_app
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Linux/macOS:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
- Install the required packages:
pip3 install -r requirements.txt
- Create a
.env
file in the project root directory and set the following environment variables:
NEWS_API_KEY=<your_newsdata_api_key>
OPENAI_API_KEY=<your_openai_api_key>
MAILCHIMP_API_KEY=<your_mailchimp_api_key>
MAILCHIMP_LIST_ID=<your_mailchimp_list_id>
Replace <your_*_api_key>
with the respective API keys.
- Make sure the
email_template/index.html
file is in place with the correct format.
- Run the Flask application:
python app.py
- Visit the following routes in your web browser or with a tool like
curl
:
http://localhost:3000/
: The application's homepagehttp://localhost:3000/fetch_news
: Fetches news articles and returns them in JSON formathttp://localhost:3000/fetch_summarized_news
: Fetches summarized news articles and displays them in an HTML list
The application will automatically send out the daily email digest at 7 AM CST.
- Flask
- requests
- openai
- mailchimp3
- python-dotenv
- re
- datetime
- pytz
- dateutil
- APScheduler
This project is released under the MIT License.