Coder Social home page Coder Social logo

johnmyrda / safeway-coupons Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smkent/safeway-coupons

1.0 0.0 0.0 322 KB

๐Ÿฅซ ๐ŸŽซ Automatic coupon clipper for Safeway's online "Safeway for U" coupons

License: GNU General Public License v3.0

Shell 2.63% Python 96.19% Dockerfile 1.18%

safeway-coupons's Introduction

Automatic Safeway coupon clipper

PyPI PyPI - Python Version Build codecov GitHub stars

safeway-coupons is a script that will log in to an account on safeway.com, and attempt to select all of the "Safeway for U" electronic coupons on the site so they don't have to each be clicked manually.

Installation and usage with Docker

A Docker container is provided which runs safeway-coupons with cron. The cron schedule and your Safeway account details may be configured using environment variables, or with an accounts file.

Example docker-compose.yaml with configuration via environment variables:

version: "3.7"

services:
  safeway-coupons:
    image: ghcr.io/smkent/safeway-coupons:latest
    environment:
      CRON_SCHEDULE: "0 2 * * *"  # Run at 2:00 AM each day
      SMTPHOST: your.smtp.host
      SAFEWAY_ACCOUNT_USERNAME: [email protected]
      SAFEWAY_ACCOUNT_PASSWORD: very_secret
      SAFEWAY_ACCOUNT_MAIL_FROM: [email protected]
      SAFEWAY_ACCOUNT_MAIL_TO: [email protected]
    restart: unless-stopped

Example docker-compose.yaml with configuration via accounts file:

version: "3.7"

services:
  safeway-coupons:
    image: ghcr.io/smkent/safeway-coupons:latest
    environment:
      CRON_SCHEDULE: "0 2 * * *"  # Run at 2:00 AM each day
      SMTPHOST: your.smtp.host
      SAFEWAY_ACCOUNTS_FILE: /accounts_file
    restart: unless-stopped
    volumes:
      - path/to/safeway_accounts_file:/accounts_file:ro

Start the container by running:

docker-compose up -d

Debugging information can be viewed in the container log:

docker-compose logs -f

Installation from PyPI

safeway-coupons is available on PyPI:

pip install safeway-coupons

sendmail is needed for email support.

For best results, run this program once a day or so with a cron daemon.

Usage

For full usage options, run

safeway-coupons --help

Configuration

safeway-coupons can clip coupons for one or more Safeway accounts in a single run, depending on the configuration method used.

If a sender email address is configured, a summary email will be sent for each Safeway account via sendmail. The email recipient defaults to the Safeway account email address, but can be overridden for each account.

Accounts are searched via the following methods in the listed order. Only one account configuration method may be used at a time.

With environment variables

A single Safeway account can be configured with environment variables:

  • SAFEWAY_ACCOUNT_USERNAME: Account email address (required)
  • SAFEWAY_ACCOUNT_PASSWORD: Account password (required)
  • SAFEWAY_ACCOUNT_MAIL_FROM: Sender address for email summary
  • SAFEWAY_ACCOUNT_MAIL_TO: Recipient address for email summary

With config file

Multiple Safeway accounts can be provided in an ini-style config file, with a section for each account. For example:

email_sender = [email protected]   ; optional

[[email protected]]       ; required
password = 12345                    ; required
notify = [email protected]     ; optional

Provide the path to your config file using the -c or --accounts-config option:

safeway-coupons -c path/to/config/file

Development

Poetry installation

Via pipx:

pip install pipx
pipx install poetry
pipx inject poetry poetry-dynamic-versioning poetry-pre-commit-plugin

Via pip:

pip install poetry
poetry self add poetry-dynamic-versioning poetry-pre-commit-plugin

Development tasks

  • Setup: poetry install
  • Run static checks: poetry run poe lint or poetry run pre-commit run --all-files
  • Run static checks and tests: poetry run poe test

Created from smkent/cookie-python using cookiecutter

safeway-coupons's People

Contributors

smkent avatar jmacknet avatar borgified avatar

Stargazers

Holger Eilhard avatar

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.