https://github.com/orengrinker/todaysfootballmatchesemailer
This project fetches today's football matches from the Live Score API and sends the details via email using SendGrid. It is designed to run as an AWS Lambda function, enabling serverless execution and scheduling.
https://github.com/orengrinker/todaysfootballmatchesemailer
aws aws-lambda football-api football-data lambda-functions livescoreapi python python3 sendgrid sendmail
Last synced: about 2 months ago
JSON representation
This project fetches today's football matches from the Live Score API and sends the details via email using SendGrid. It is designed to run as an AWS Lambda function, enabling serverless execution and scheduling.
- Host: GitHub
- URL: https://github.com/orengrinker/todaysfootballmatchesemailer
- Owner: OrenGrinker
- Created: 2024-02-17T18:17:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-17T19:09:59.000Z (over 1 year ago)
- Last Synced: 2025-02-09T05:39:01.980Z (4 months ago)
- Topics: aws, aws-lambda, football-api, football-data, lambda-functions, livescoreapi, python, python3, sendgrid, sendmail
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Today's Football Matches Emailer
This project fetches today's football matches from the Live Score API and sends the details via email using SendGrid. It is designed to run as an AWS Lambda function, enabling serverless execution and scheduling.
## Features
- Fetch today's football matches based on competition.
- Send an email with the matches using SendGrid.
- Serverless execution with AWS Lambda.
- Scheduled fetching and emailing with Amazon CloudWatch Events.## Getting Started
### Prerequisites
- Python 3.6+
- SendGrid account
- Live Score API account
- AWS account with access to AWS Lambda, Amazon CloudWatch, and optionally AWS Secrets Manager### Installation
1. **Clone the repository:**
git clone https://github.com/OrenGrinker/todays-football-matches-emailer.git2. **Install required packages:**
pip install requests sendgridNote: When deploying to AWS Lambda, package your application with dependencies unless using AWS Lambda Layers for dependencies.
### Configuration
- Create API keys at [SendGrid](https://sendgrid.com/) and [Live Score API](https://live-score-api.com/).
- Navigate to [Live Score API Competitions](https://live-score-api.com/competitions) to find `COMPETITION_ID` for your league.
- Update `config.py` with your API keys, email addresses, and `COMPETITION_ID`.
- (Optional) For enhanced security, store your API keys and secrets in AWS Secrets Manager.### Deploying to AWS Lambda
1. **Package your application:** Zip your code and dependencies.
2. **Create a new AWS Lambda function:** Upload your ZIP file and set the runtime to Python 3.8 or newer. Use `main.lambda_handler` as the handler.
3. **Schedule execution with Amazon CloudWatch Events:** Create a new rule to trigger your Lambda function on a schedule.
4. **Update IAM permissions:** Ensure your Lambda function has permissions to access necessary AWS services, including Secrets Manager if used.### AWS Lambda Environment Variables
- Instead of hardcoding sensitive information, use environment variables in the AWS Lambda console to store API keys, email addresses, and `COMPETITION_ID`.
### Usage
Once deployed and scheduled, the AWS Lambda function will run according to the schedule you set in CloudWatch Events, fetching today's football matches and sending an email without manual intervention.
## License
This project is open source and available under the MIT License.