Skip to content

Python tool that automatically notifies users about free games on Epic Games Store via email using GitHub Actions - no need to refresh your browser every day! ๐Ÿ˜๐Ÿซฐ

License

Notifications You must be signed in to change notification settings

sh13y/epic-free-games-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Epic Free Games Notifier

Build Status License

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.

Features

  • 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! โฐ)

Prerequisites

  • Python 3.x (Python 2.x is so last decade ๐Ÿ•ฐ๏ธ)
  • GitHub account (You have one, right? ๐Ÿค”)

Setup

1. Clone the Repository

git clone https://github.com/sh13y/epic-free-games-notifier.git
cd epic-free-games-notifier

2. Install Dependencies

pip install -r requirements.txt

3. Configure Environment Variables

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

4. Run the Script Locally

python check_free_games.py

GitHub Actions Integration

1. Add Secrets to GitHub Repository

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

2. Configure GitHub Actions Workflow

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! ๐ŸŽ‰)

3. Enable GitHub Actions

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! ๐Ÿ›‹๏ธ)

Script Details

The check_free_games.py script performs the following steps:

  1. Fetch Free Games: The script fetches the list of free games from the Epic Games Store. (Free games, yay! ๐Ÿฅณ)
  2. 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! ๐Ÿ“ฌ)

Example Code Snippet

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()

Screenshot

Here is an example of the email you will receive (yes, it looks this good!): Email Screenshot

Future Enhancements

Some ideas for future improvements:

  • Support for additional gaming platforms
  • Integration with messaging platforms like Discord
  • User preference management for customized notifications

Contributing

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! โค๏ธ)

License

This project is licensed under the WTFPL License. See the LICENSE file for more details. (Do what you want, it's free! ๐Ÿ˜Ž)

Code Structure

  • 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

Error Handling

The script handles several error cases:

  • API connection failures
  • Invalid response data
  • Missing game information
  • Email sending failures

Return Values

  • fetch_free_games(): Returns None if no games found or on error, otherwise returns a list of free games
  • send_email(): Returns None after sending email or on error

Recent Updates

  • 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

About

Python tool that automatically notifies users about free games on Epic Games Store via email using GitHub Actions - no need to refresh your browser every day! ๐Ÿ˜๐Ÿซฐ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages