Automate your grocery shop.
Project description
autogroceries
autogroceries simplifies grocery shopping from Sainsbury's by using Playwright to automate the addition of ingredients to your basket.
Installation
I recommend using uv to manage the python version, virtual environment and autogroceries installation:
uv venv --python 3.13
source .venv/bin/activate
uv pip install autogroceries
# Install Chromium browser binary required for playwright.
playwright install chromium
Usage
autogroceries uses Playwright to interface with the Sainsbury's website, automatically filling your cart with an inputted list of ingredients. autogroceries can be used as a CLI tool or a python package.
CLI
autogroceries has a single CLI command:
❯ autogroceries --help
Usage: autogroceries [OPTIONS]
Automate your grocery shopping using playwright.
Please set the [STORE]_USERNAME and [STORE]_PASSWORD in a .env file in the
same directory you run autogroceries. Replace [STORE] with the store name in
caps e.g. SAINSBURYS_USERNAME.
Options:
--store [sainsburys] The store to shop at. [required]
--ingredients-path PATH Path to csv file (without header) detailing
ingredients. Each line should in format
'ingredient,quantity' e.g. 'eggs,2'. [required]
--log-path PATH If provided, will output shopping log to this path.
--help Show this message and exit.
The autogroceries CLI expects a .env file in the same directory from where you execute the command. This .env will be loaded by python-dotenv and should define the "[STORE]_USERNAME" and "[STORE]_PASSWORD" variables, with "[STORE]" replaced by the name of the store in uppercase, for instance:
# .env
SAINSBURYS_USERNAME=your_username
SAINSBURYS_PASSWORD=your_password
Python package
autogroceries can be used as a Python package, making it easy to integrate automated grocery shopping into scripts or pipelines:
from autogroceries.shopper.sainsburys import SainsburysShopper
# Store credentials securely e.g. in environment variables (loaded with python-dotenv).
shopper = SainsburysShopper(
username=os.getenv("SAINSBURYS_USERNAME"),
password=os.getenv("SAINSBURYS_PASSWORD"),
)
shopper.shop({"lemon": 1, "tomatoes": 2})
Demo: autogroceries in action
Your browser does not support the video tag.Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autogroceries-2.1.0.tar.gz.
File metadata
- Download URL: autogroceries-2.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f38e027f8c272ee9daa111b6cd7ab7e344e89ee0a8b7e761f0c16f4156b1b75
|
|
| MD5 |
f1442ad95f5a6b5474bf7da93f7c6f94
|
|
| BLAKE2b-256 |
1bd189ff6f68d40482228d8ade452ce39df312718417025a93d22f347e9be9c0
|
Provenance
The following attestation bundles were made for autogroceries-2.1.0.tar.gz:
Publisher:
test_deploy.yml on dzhang32/autogroceries
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autogroceries-2.1.0.tar.gz -
Subject digest:
9f38e027f8c272ee9daa111b6cd7ab7e344e89ee0a8b7e761f0c16f4156b1b75 - Sigstore transparency entry: 483960966
- Sigstore integration time:
-
Permalink:
dzhang32/autogroceries@643bee0e17d6f0b41fce68242f8c79d014f5c4d2 -
Branch / Tag:
refs/tags/2.1.0 - Owner: https://github.com/dzhang32
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test_deploy.yml@643bee0e17d6f0b41fce68242f8c79d014f5c4d2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file autogroceries-2.1.0-py3-none-any.whl.
File metadata
- Download URL: autogroceries-2.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
439b4c16a14d39138bc807cc43786e9c08cc3c84d0222b2c6a37b866a9cf66df
|
|
| MD5 |
d69d799aba7ebd86662c8a78eb18ae93
|
|
| BLAKE2b-256 |
04670ec5923eee653f4bc366091188c807ed801f39ff526c00896685665d911a
|
Provenance
The following attestation bundles were made for autogroceries-2.1.0-py3-none-any.whl:
Publisher:
test_deploy.yml on dzhang32/autogroceries
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autogroceries-2.1.0-py3-none-any.whl -
Subject digest:
439b4c16a14d39138bc807cc43786e9c08cc3c84d0222b2c6a37b866a9cf66df - Sigstore transparency entry: 483960979
- Sigstore integration time:
-
Permalink:
dzhang32/autogroceries@643bee0e17d6f0b41fce68242f8c79d014f5c4d2 -
Branch / Tag:
refs/tags/2.1.0 - Owner: https://github.com/dzhang32
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test_deploy.yml@643bee0e17d6f0b41fce68242f8c79d014f5c4d2 -
Trigger Event:
push
-
Statement type: