safeway-coupons is a tool 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.
Safeway's sign in page is protected by a web application firewall (WAF). safeway-coupons performs authentication using Google Chrome. Authentication may fail based on your IP's reputation, either by presenting an interactive challenge or denying sign in attempts altogether.
safeway-coupons currently does not have support for prompting the user to solve interactive challenges.
Safeway's sign in page may also require verifying a new device with a multi-factor authentication (MFA) verification code. To reduce how often this happens, a persistent Google Chrome profile directory is created for each account and reused for logins with the same account. Once a signed in session is established, coupon clipping is performed using HTTP requests via requests .
Installation and usage
Google Chrome (for authentication performed via patchright ).
Optional: sendmail (for email support)
Installation with uv or pipx is recommended:
Installation with pip is also available:
For best results, run this program once a day or so with a cron daemon.
For full usage options, run
Accounts configuration
safeway-coupons can clip coupons for one or more Safeway accounts in a single run.
Commands are provided for managing accounts. The most useful commands are listed below. For a full list of account management commands, run:
Accounts file location
Account configuration is stored within accounts.toml in the local config directory. To see the accounts.toml path, run:
An account is referred to by a name you choose (similar to a label). Account names are converted to lower case and may not contain spaces or slashes.
To add a new account, run:
If account-name or sign-in-email from the above example are omitted, accounts add will prompt for them interactively.
accounts add will prompt for an optional email sender and/or email recipient address, for use if email summaries are enabled. These may be left blank to use the sign in email instead.
Listing configured accounts
To list all configured accounts, run:
Updating an account password
To update the saved password for a configured account, run:
To remove a configured account, run:
An account's persistent data, such as its browser profile, is not deleted automatically. The accounts remove command shows the location of this directory when an account is deleted.
Example accounts.toml
Each account is named using a TOML table name placed within the top level accounts table, e.g. [accounts.(name)] . Account names are converted to lower case and may not contain spaces or slashes.
An example accounts.toml :
Migration from legacy ini-style configuration file
safeway-coupons previously supported an ini-style accounts configuration file used with the now deprecated -c / --accounts-config option.
To import accounts from a legacy ini-style accounts configuration file, run:
Migration from legacy environment variable account configuration
safeway-coupons previously supported using environment variables to configure a single account. If legacy account configuration environment variables are set, a warning is logged and accounts.toml is ignored.
Legacy environment variable based account configuration may be removed in a future release. To migrate:
Unset environment variables beginning with SAFEWAY_ACCOUNT_
Configure the account by running:
Multi-factor authentication (MFA) verification codes
Safeway's sign in page will ask for an MFA code when signing in from a new device, and occasionally on other logins.
When run interactively, safeway-coupons can request Safeway's sign in page to send an MFA code to the first listed destination for your account (e.g. email or text). safeway-coupons will then prompt for the code in the terminal to complete sign in. To sign in interactively with an MFA code, run:
Scheduled and noninteractive invocations of safeway-coupons cannot obtain or enter MFA verification codes. If the sign in page asks for an MFA code, safeway-coupons exits with an error message. When this happens, run safeway-coupons interactively to refresh your sign in session.
Local data storage defaults to these locations:
User config directory (see user_config_dir ) for user configuration such as accounts
User state directory (see user_state_dir ) for persistent state such as browser profiles
To view local data storage locations, run:
Installation and usage with Docker Compose
A Docker container is provided which runs safeway-coupons with cron. The cron schedule may be configured using environment variables.
Example compose.yaml :
With this example, account configuration is stored at ./config/accounts.toml .
Accounts configuration
To run specific safeway-coupons commands within a Docker compose configured container, run:
Accounts configuration with Docker uses the same accounts management commands described in the main Installation and usage / Accounts configuration section. Examples:
docker compose run --rm safeway-coupons accounts add
docker compose run --rm safeway-coupons accounts list
docker compose run --rm safeway-coupons accounts set-password
docker compose run --rm safeway-coupons accounts remove
After configuring accounts, run safeway-coupons once to sign in to each of the accounts, and enter any multi-factor authentication (MFA) verification codes if prompted:
docker compose run --rm safeway-coupons --login-only
Note that running safeway-coupons in a Docker container with no command arguments (such as simply docker compose run --rm safeway-coupons ) will run the cron service instead of running safeway-coupons interactively.
Migration from legacy ini-style configuration file
safeway-coupons previously supported an ini-style accounts configuration file used in Docker with the SAFEWAY_ACCOUNTS_FILE environment variable.
To import accounts from a legacy ini-style accounts configuration file using SAFEWAY_ACCOUNTS_FILE :
Ensure the container mounts a volume at /storage/config similar to the compose.yaml example. (Keep the SAFEWAY_ACCOUNTS_FILE environment variable and volume mount until a later step.)
Convert the saved accounts to the new format and location by running:
Remove the SAFEWAY_ACCOUNTS_FILE environment variable and associated volume mount from your Docker compose configuration ( compose.yaml )
Migration from legacy environment variable account configuration
safeway-coupons previously supported using environment variables to configure a single account. If legacy account configuration environment variables are set, a warning is logged and accounts.toml is ignored.
Legacy environment variable based account configuration may be removed in a future release. To migrate:
Ensure the container mounts a volume at /storage/config similar to the compose.yaml example.
Remove environment variables beginning with SAFEWAY_ACCOUNT_ from your Docker compose configuration ( compose.yaml )
Configure the account by running:
Start the container by running:
Debugging information can be viewed in the container log:
Stop the container by running:
Building a container locally with docker compose
To build the safeway-coupons container locally when using docker compose , replace the image: line in your compose.yaml with build: . :
Then, when using docker compose up -d , include --build :
Copyright (C) 2012 Stephen Kent and contributors
Licensed under the GNU General Public License v3.0 or later ( GPL-3.0-or-later ).
This project is based on and maintained with copier-project .
Release files for safeway-coupons 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation .
Source distribution (sdist)
Built distribution (wheel)
Total release size: 110.2 kB
Release files / safeway_coupons-0.10.0.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Release files / safeway_coupons-0.10.0-py3-none-any.whl
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Security for safeway-coupons 0.10.0
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Both files in this release have been uploaded with provenance metadata.
Attestation for safeway_coupons-0.10.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Attestation for safeway_coupons-0.10.0-py3-none-any.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
Release history Release notifications | RSS feed
Nov 24, 2026 2 release files Full provenance
Nov 23, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 19, 2026 2 release files Full provenance
Nov 19, 2026 2 release files Full provenance
Nov 18, 2026 2 release files Full provenance
Nov 17, 2026 2 release files Full provenance
Nov 16, 2026 2 release files Full provenance
Nov 15, 2026 2 release files Full provenance
Nov 13, 2026 2 release files Full provenance
Nov 13, 2026 2 release files Full provenance
Nov 11, 2026 2 release files Full provenance
Nov 11, 2026 2 release files Full provenance
Jan 15, 2025 2 release files Full provenance
Mar 5, 2024 2 release files No provenance
Jan 28, 2024 2 release files No provenance
Jan 10, 2024 2 release files No provenance
Dec 18, 2023 2 release files No provenance
Nov 1, 2023 2 release files No provenance
Nov 1, 2023 2 release files No provenance
Jul 13, 2023 2 release files No provenance
Jul 13, 2023 2 release files No provenance
Jul 11, 2023 2 release files No provenance
Jul 10, 2023 2 release files No provenance
Jul 10, 2023 2 release files No provenance
Jul 10, 2023 2 release files No provenance
Jul 10, 2023 2 release files No provenance
Feb 23, 2023 2 release files No provenance
Feb 21, 2023 2 release files No provenance
Feb 20, 2023 2 release files No provenance
Dec 11, 2022 2 release files No provenance
Dec 11, 2022 2 release files No provenance
Nov 10, 2022 2 release files No provenance
Nov 5, 2022 2 release files No provenance
Nov 5, 2022 2 release files No provenance
Nov 4, 2022 2 release files No provenance
Oct 27, 2022 2 release files No provenance
Oct 25, 2022 2 release files No provenance
Aug 28, 2022 2 release files No provenance
Aug 26, 2022 2 release files No provenance
Aug 25, 2022 2 release files No provenance
Aug 25, 2022 2 release files No provenance
Aug 25, 2022 2 release files No provenance
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
