Skip to main content

pyhellofresh

Async Python client library for accessing HelloFresh APIs. Designed to be completely standalone, fully typed, and ready for integration into Python applications or Home Assistant integrations.

Guides and the API reference are published at https://pantherale0.github.io/pyhellofresh/.

Features

  • 100% Asynchronous: Built on top of aiohttp for non-blocking HTTP requests.
  • Session Injection: Supports injecting custom aiohttp.ClientSession or auto-managing internal sessions.
  • Authentication: Supports direct Bearer JWT token initialization, token refreshing (refresh_access_token), and passwordless magic link login (start_passwordless_login & finish_passwordless_login).
  • Data Endpoints:
    • Customer Profile & Dietary Exclusions (get_profile)
    • Account Credit Balance (get_balance)
    • Weekly Delivery Schedule & Past Deliveries (get_past_deliveries)
    • Weekly Menus & Selected Meals (get_menu)
    • Full Recipe Details, Ingredients, Nutrition & Step Instructions (get_recipe)
    • Cart Price Calculations (get_cart_price)
  • Strictly Typed: Dataclass models for all API resources.

Installation

pip install pyhellofresh

Quickstart Example

import asyncio
from pyhellofresh import HelloFreshClient


async def main():
    # Initialize client with existing Bearer token
    client = HelloFreshClient(
        access_token="YOUR_ACCESS_TOKEN", country="GB", locale="en-GB"
    )

    # Fetch profile
    profile = await client.get_profile()
    print(f"Adults: {profile.adults}, Exclusions: {profile.exclusions}")

    # Fetch weekly menu for 2026-W32
    menu = await client.get_menu(week="2026-W32")
    print(f"Week: {menu.week}, Total meals available: {len(menu.meals)}")

    # Close session
    await client.close()


if __name__ == "__main__":
    asyncio.run(main())

Passwordless Login Flow

import asyncio
from pyhellofresh import HelloFreshClient


async def login():
    async with await HelloFreshClient.with_session() as client:
        # Step 1: Trigger magic link email
        public_id = await client.start_passwordless_login("user@example.com")
        print(f"Magic link sent. Public ID: {public_id}")

        # Step 2: Extract code from link clicked in email and complete login
        token_resp = await client.finish_passwordless_login(
            code="CODE_FROM_EMAIL_LINK",
            email="user@example.com",
            public_id=public_id,
        )
        print(f"Access Token: {token_resp.access_token}")
        print(f"Refresh Token: {token_resp.refresh_token}")

Token Refreshing

async def refresh(client: HelloFreshClient):
    new_tokens = await client.refresh_access_token()
    print(f"Updated Access Token: {new_tokens.access_token}")

Testing with the Test Script

A ready-to-use CLI test script example_test.py is provided to quickly test API connectivity and models:

# Test with an existing Bearer JWT token:
python3 example_test.py --token "YOUR_ACCESS_TOKEN"

# Test passwordless magic link flow:
python3 example_test.py --email "user@example.com"

# Test token refresh:
python3 example_test.py --refresh-token "YOUR_REFRESH_TOKEN"

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'

# Run tests & coverage
pytest --cov=pyhellofresh

License

MIT

Metadata

Release files for pyhellofresh 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyhellofresh 0.2.0
File Size Uploaded
pyhellofresh-0.2.0.tar.gz 25.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyhellofresh 0.2.0
File Interpreter ABI Platform
pyhellofresh-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.9 kB

Release files / pyhellofresh-0.2.0.tar.gz

Download URL pyhellofresh-0.2.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7ba1f0b7e96b855e1839e46a5d38788aa84708b6da83fd79ac312f6c3fd5cb33
BLAKE2b-256 checksum
How to use checksums
7133f68a3d9b2ffff03e4ef251408e0627c74abc5b922e9516c309ac454b1f20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

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 Sep 27, 2026.

Transparency log

Release files / pyhellofresh-0.2.0-py3-none-any.whl

Download URL pyhellofresh-0.2.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2372bdee2d4e9777f6939eeedd7b40021a6e0d9f5a9f7285971e721787d85d76
BLAKE2b-256 checksum
How to use checksums
8b4db34d5b81f6e8d9c596fc4697ea77619db1478ad52235a0cef4cefe8b8a28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

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 Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page