A Python-based notification system to automatically track and notify users about free games on the Epic Games Store. Because who doesn't love free games? ๐ฎ
Note for 99x Internship Application: While this was originally developed as a personal project, I've created a simulated client scenario to demonstrate how I would approach a client-based project. See the simulated client project documentation for details.
- Fetches free games from the Epic Games Store. (Yes, free as in zero dollars! ๐ธ)
- Sends email notifications with details about the free games. (No spam, we promise! ๐ง)
- Scheduled to run daily using GitHub Actions. (Set it and forget it! โฐ)
- Python 3.x (Python 2.x is so last decade ๐ฐ๏ธ)
- GitHub account (You have one, right? ๐ค)
git clone https://github.com/sh13y/epic-free-games-notifier.git
cd epic-free-games-notifier
pip install -r requirements.txt
Create a .env
file in the root directory of the project and add the following environment variables:
SMTP_SERVER=your_smtp_server
SMTP_PORT=your_smtp_port
EMAIL=your_email
PASSWORD=your_email_password
TO_EMAIL=recipient_email
FROM_EMAIL=your_from_email
python check_free_games.py
Go to your GitHub repository, navigate to Settings > Secrets and variables > Actions
, and add the following secrets:
SMTP_SERVER
SMTP_PORT
EMAIL
PASSWORD
TO_EMAIL
FROM_EMAIL
The workflow file is located at notify_free_games.yml
. It is configured to run daily at 12:00 UTC and can also be triggered manually. (Because sometimes you just can't wait for free games! ๐)
Ensure that GitHub Actions is enabled for your repository. The workflow will automatically run according to the schedule and send email notifications. (Sit back and relax! ๐๏ธ)
The check_free_games.py
script performs the following steps:
- Fetch Free Games: The script fetches the list of free games from the Epic Games Store. (Free games, yay! ๐ฅณ)
- Send Email Notification: If free games are found, the script sends an email notification with the details of the free games. (Your inbox will thank you! ๐ฌ)
try:
logging.info("Connecting to SMTP server...")
with smtplib.SMTP(SMTP_SERVER, int(SMTP_PORT)) as server:
server.set_debuglevel(1) # Enable debug logs
server.starttls()
logging.info("Logging in to SMTP server...")
server.login(EMAIL, PASSWORD)
logging.info("Sending email...")
server.send_message(msg)
logging.info("Email sent successfully.")
except Exception as e:
logging.error(f"Failed to send email: {e}")
def main():
"""Main function to fetch games and send notifications."""
logging.info("Fetching free games...")
free_games = fetch_free_games()
if free_games:
logging.info("Free games found! Sending notification...")
send_email(free_games)
else:
logging.info("No free games available at the moment.")
if __name__ == "__main__":
main()
Here is an example of the email you will receive (yes, it looks this good!):
Some ideas for future improvements:
- Support for additional gaming platforms
- Integration with messaging platforms like Discord
- User preference management for customized notifications
Feel free to open issues or submit pull requests if you have any improvements or suggestions. (We love contributions as much as we love free games! โค๏ธ)
This project is licensed under the WTFPL License. See the LICENSE
file for more details. (Do what you want, it's free! ๐)
- Organized imports following PEP 8 standards
- Standard library imports first
- Third-party imports (requests, dotenv) separated
- Type hints added for better code readability
- Error handling for API responses and data parsing
- Logging for tracking execution and errors
The script handles several error cases:
- API connection failures
- Invalid response data
- Missing game information
- Email sending failures
fetch_free_games()
: ReturnsNone
if no games found or on error, otherwise returns a list of free gamessend_email()
: ReturnsNone
after sending email or on error
- Code Refactoring:
- Improved code organization following PEP 8
- Enhanced error handling for better reliability
- Added type hints for better code maintenance
- Documentation:
- Added detailed error handling documentation
- Clarified function return values
- Updated technical architecture details