Unofficial Python client for the Albert Heijn API.
Project description
python-appie
python-appie is an unofficial async Python client for the Albert Heijn API.
Full documentation lives in docs/, is built from mkdocs.yml, and is intended to be published at tijnschouten.github.io/appie.
Releases are intended to publish to PyPI as python-appie from version tags via GitHub Actions.
Install
uv add python-appie
Or:
pip install python-appie
For local development in this repository:
uv sync --extra dev
pre-commit install
Quick start
Authenticate once:
uv run appie-login
This opens Chrome for an interactive AH login and captures the OAuth redirect code automatically. If automatic capture cannot start, the CLI falls back to asking for the redirect URL or raw code manually.
Then use the client:
import asyncio
from appie import AHClient
async def main() -> None:
async with AHClient() as client:
products = await client.products.search("melk", limit=3)
for product in products:
print(product)
asyncio.run(main())
Tokens are stored in ~/.config/appie/tokens.json and refreshed automatically when they are close to expiring.
Features
Authentication
appie-loginCLI for browser-based login- automatic code capture from the AH redirect flow
- token persistence in
~/.config/appie/tokens.json - automatic token refresh using the stored refresh token
Products
- search products via
client.products.search(query, limit=10) - fetch a single product via
client.products.get(product_id)
Example:
import asyncio
from appie import AHClient
async def main() -> None:
async with AHClient() as client:
product = await client.products.get(1525)
print(product)
asyncio.run(main())
Receipts
- list in-store POS receipt summaries via
client.receipts.list_all(limit=50) - fetch a receipt with line items via
client.receipts.get_pos_receipt(receipt_id)
Important:
list_all() and list_pos_receipts() return receipt summaries. In those results, products is intentionally empty.
To retrieve line items, call get_pos_receipt() with a receipt ID from the summary list.
Example:
import asyncio
from appie import AHClient
async def main() -> None:
async with AHClient() as client:
receipts = await client.receipts.list_all(limit=5)
detailed = await client.receipts.get_pos_receipt(receipts[0].id)
print(detailed)
asyncio.run(main())
Shopping lists
- add an item via
client.lists.add_item(description, quantity=1, product_id=None) - use
MockAHClientfor local development and tests without touching AH
Example:
import asyncio
from appie import AHClient
async def main() -> None:
async with AHClient() as client:
item = await client.lists.add_item("Halfvolle melk", quantity=2)
print(item)
asyncio.run(main())
Current limitation:
shopping-list add is implemented, but get_list(), remove_item(), and clear() still raise NotImplementedError until their live API shape is confirmed.
API overview
Main client
AHClient()MockAHClient()await client.login()await client.graphql(query, variables=None)
Auth client
AHAuthClient.get_anonymous_token()AHAuthClient.login_with_code(code)AHAuthClient.refresh_token(refresh_token)
Sub-APIs
client.products.search(query, limit=10)client.products.get(product_id)client.receipts.list_pos_receipts(limit=50)client.receipts.list_all(limit=50)client.receipts.get_pos_receipt(receipt_id)client.lists.add_item(description, quantity=1, product_id=None)client.lists.get_list()client.lists.remove_item(item_id)client.lists.clear()
Development
Run checks locally:
uv run ruff format .
uv run --extra dev ruff check .
uv run --extra dev pyright
uv run --extra dev pytest
uv run --extra dev mkdocs build --strict
Notes
- This client is unofficial and may break when Albert Heijn changes its backend.
- Receipt support currently covers in-store POS receipts.
- Shopping-list support only implements the verified add-item mutation; other operations raise explicit
NotImplementedErroruntil their GraphQL shape is confirmed. - Receipt summaries do not include line items; call
get_pos_receipt()for a detailed receipt. - Endpoint discovery for this package is inspired by gwillem/appie-go.
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 python_appie-0.1.0.tar.gz.
File metadata
- Download URL: python_appie-0.1.0.tar.gz
- Upload date:
- Size: 81.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e70c2bb6fa454eb065646b21f9b4519a6be0dd81bde72d2abd70279856951621
|
|
| MD5 |
7f430dfda20529a02725e9ab5bcd3c91
|
|
| BLAKE2b-256 |
733732e795d7f665457f8c94cfad56cc9436919ccb0b88deb3b40f9261f2d827
|
Provenance
The following attestation bundles were made for python_appie-0.1.0.tar.gz:
Publisher:
pypi.yml on tijnschouten/appie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_appie-0.1.0.tar.gz -
Subject digest:
e70c2bb6fa454eb065646b21f9b4519a6be0dd81bde72d2abd70279856951621 - Sigstore transparency entry: 1154580655
- Sigstore integration time:
-
Permalink:
tijnschouten/appie@3a2733548c538317b44de9a9334725d98deb6413 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tijnschouten
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3a2733548c538317b44de9a9334725d98deb6413 -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_appie-0.1.0-py3-none-any.whl.
File metadata
- Download URL: python_appie-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 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 |
1cab049f3e418813ac133b6acdb1f53d21a7c716720e906a411d3c75293f6124
|
|
| MD5 |
fb22c42950bd146e1da8cdaaed8740fb
|
|
| BLAKE2b-256 |
f38a35b8ea9f9ad4efe5bd0e88d5e69d5fd3e86d9ee0b91e6035dfc1f6b304c1
|
Provenance
The following attestation bundles were made for python_appie-0.1.0-py3-none-any.whl:
Publisher:
pypi.yml on tijnschouten/appie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_appie-0.1.0-py3-none-any.whl -
Subject digest:
1cab049f3e418813ac133b6acdb1f53d21a7c716720e906a411d3c75293f6124 - Sigstore transparency entry: 1154580664
- Sigstore integration time:
-
Permalink:
tijnschouten/appie@3a2733548c538317b44de9a9334725d98deb6413 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tijnschouten
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3a2733548c538317b44de9a9334725d98deb6413 -
Trigger Event:
push
-
Statement type: