Giter Site home page Giter Site logo

trannel / fundgrube-notifier Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 78 KB

Python script for notifications of individual offers in the Saturn/MediaMarkt Fundgrube.

License: Apache License 2.0

Python 100.00%
email mediamarkt python saturn fundgrube notification

fundgrube-notifier's Introduction

Fundgrube Notifier

This project notifies you about current offers from the German electronics retail chains Saturn and MediaMarkt in their Fundgrube, that match specific conditions you can define.

Setup

Before you start make sure python 3.9 (or higher) and poetry are installed on your machine.

First, clone the project, navigate to its root directory, and install the dependencies (this automatically creates a virtual environment):

poetry install

Next, rename the file sample_products.json in the data directory to products.json and fill it as specified in the Options section.

Email notifications

If you want to get email notifications, the easiest way is to use a Google account (for Gmail) with 2FA enabled. In your account you have to generate an app password for Gmail. While creating the password select "Mail" as app and "Other" as device (select as custom name you see fit, e.g., "Raspberry Pi"). We need to use app passwords (which in turn require 2FA) due to a policy change in mid-2022. Lastly, you have to rename the sample.env to .env and fill it as follows:

  • MAIL_SENDER The gmail address you want to send the emails from.
  • MAIL_PASSWORD The 16-digit app password you generated.
  • MAIL_RECEIVER If you want to receive the emails on another address, set it here. (Optional)

If you do not want to use Gmail you also have to specify:

  • SMTP_SERVER The SMTP server of your email provider.
  • SMTP_PORT The corresponding SMTP port.

Be aware though, that non-Gmail approaches might run into issues with 2FA etc. and were not tested.

Usage

Once everything is set up, you can run the script with

poetry run python fundgrube_notifier.py

Cron job

You can also set up a cron job (or something similar) to automatically execute the script every hour. For this, open the cron tab with

crontab -e

and then add the following line to configure the cron job (replace <path> with the path to this project's root directory):

5 8-23 * * * cd <path>/fundgrube-notifier && poetry run python fundgrube_notifier.py

Make sure that cron has access to the correct $PATH (e.g., for poetry), by copying the following line above the definition of the cron job (replace <user> with your device's username):

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/<user>/.local/bin

See this Stack Overflow post for more details regarding cron and $PATH.

Options

Entries in the products.json file are created in JSON format and every JSON object can have the following attributes to filter the available articles:

  • include: A list of terms that must appear in the name of the article (case-insensitive; AND operator). (Mandatory).
    • Also accepts lists of terms instead of terms, of which only one term has to match (OR operator; see example).
  • exclude: A list of terms, that must not appear in the name of the article (case-insensitive). (Optional)
  • price: Articles with a higher price are ignored. (Optional)
  • store: A list of terms, that must appear in the name of the store (case-insensitive). (Optional)

When choosing the terms for include, exclude, and store, remember that only simple string matching is done, so sometimes only using substrings might be beneficial.

Example

[
{
"include": ["sony", "tv"],
"exclude": ["lcd"]
},
{
"include": ["playstation"],
"price": 20,
"store": ["köln"]
}
]

Fundgrube

The Fundgrube has special offers that are usually very limited in numbers and can be found here:

Data

This project is using already preprocessed data, which is crawled hourly by a script from Barney at mydealz:

More info: https://www.mydealz.de/diskussion/die-saturn-fundgrube-ist-da-einzelstucke-in-einzelnen-markten-gunstig-kaufen-1764598

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.