Skip to content

Releases: dvejsada/rohlik_api_python

v0.3.0 - Other Rohlík Group shops

Choose a tag to compare

@dvejsada dvejsada released this 27 Sep 06:01
d4779ff

Every Rohlík Group shop can now be targeted using presets published by the library, and the cart model reports its currency and the shop's minimum order value.

Added

  • SITES / Site: presets for all Rohlík Group shops, keyed by country code: cz Rohlík.cz, de Knuspr.de, at Gurkerl.at, hu Kifli.hu, ro Sezamo.ro. Each has code, name, base_url, currency and timezone. Usage: RohlikAPI(user, pw, base_url=SITES["de"].base_url) (#10)
  • CartItem.currency: ISO 4217 code of the item price, e.g. "EUR" (#10)
  • Cart.currency: taken from the cart's items, because the cart response has no currency of its own. It is None when the cart is empty or no item reports one (#10)
  • Cart.minimum_order_price: the shop's minimum order value, from minimalOrderPrice, which was previously dropped. It is None if the API omits it; anonymous carts report 0 (#9)

Changed

  • The Cart.can_make_order docstring no longer claims it tracks the minimum order. submitConditionPassed also requires checkout details such as a delivery slot, so compare total_price with minimum_order_price instead.
  • Documentation (#12):
    • The README now covers the other shops (new "Other shops" section) and documents products.get_cards, products.get_week_sales, delivery.get_addresses and delivery.get_active_address_id.
    • The README's error-handling section is complete.
    • example.py shows how to pick a shop.
    • PUBLISHING.md describes the real release flow.

Compatibility

  • No breaking changes. The new dataclass fields have defaults and come after the existing ones, and the new exports only add names.
  • Requires Python 3.13+.

Install: pip install --upgrade rohlik-api

v0.2.0 - Weekly Deals

Choose a tag to compare

@dvejsada dvejsada released this 28 Jun 12:03
1c2f7c8

Delivery time-slots now work for accounts whose login doesn't return an
address, plus new bulk product lookups and a weekly-deals helper.

Fixed

  • Delivery slots when login omits an address. The Rohlik login response
    doesn't always include a delivery address (data.address can be null),
    which left address_id unset and made delivery.get_next_slots() return
    None. It now falls back to the saved delivery-address list, prefers the
    address you're currently delivered to (isDeliveredTo), and caches the
    resolved id so later calls stay a single request.

Added

  • delivery.get_addresses() — list the account's saved delivery
    addresses.
  • delivery.get_active_address_id() — resolve the delivery address id
    used for time-slot lookups.
  • products.get_cards(product_ids) — fetch basic data for many products
    in a single request (bulk /products/card endpoint).
  • products.get_week_sales() — this week's deals ("Akce týdne"),
    enriched with product data in one follow-up request.
  • ProductCard model — a trimmed, meaningful product shape: id,
    name, brand, amount, unit, price (sale price when on sale, else
    regular), original_price, unit_price, currency, on_sale,
    sale_valid_till, in_stock. Website display-only fields are omitted.
  • AuthManager.address_id setter — to cache a resolved address.

Compatibility

  • No breaking changes. Public API and existing return types are unchanged;
    all additions are new methods/model.
  • Requires Python 3.13+.

Install: pip install --upgrade rohlik-api

v0.1.0

Choose a tag to compare

@dvejsada dvejsada released this 27 Jun 20:37
7285194

rohlik-api v0.1.0

Initial release of rohlik-api, an async Python client for the Rohlík.cz grocery API.

⚠️ Unofficial & personal-use only. This package wraps Rohlík.cz's private (non-public) API. It is not affiliated with, endorsed by, or supported by Rohlík.cz, and the upstream API may change without notice. Use it for your own account only.

Highlights

  • Fully async, built on aiohttp — no blocking calls in the event loop.
  • Bring your own session — pass an existing aiohttp.ClientSession (e.g. Home Assistant's shared session); an injected session is never closed by the client.
  • Transparent re-authentication — when a request hits HTTP 401 (expired login), the client re-logs in and retries once, so long-lived clients keep working. Concurrent 401s trigger a single re-login.
  • Typed dataclass models for parsed responses, with documented fields (units, IDs, meanings) — usable from an IDE or by an LLM without extra docs. Ships py.typed.
  • Clean, service-based API under a single RohlikAPI facade.

Requirements

  • Python 3.13+
  • aiohttp (installed automatically)

Installation

pip install rohlik-api

Quick start

import asyncio
from rohlik_api import RohlikAPI

async def main():
    async with RohlikAPI("you@example.com", "password") as client:
        cart = await client.cart.get_content()
        print(cart.total_price, cart.total_items)

        results = await client.products.search("mléko", limit=5)
        for p in results.results:
            print(p.name, p.price)

asyncio.run(main())

What's included

  • Cart — get_content, add_items, delete_item
  • Products — search, get_ai_summary, get_composition, get_price, get_detail, get_categories
  • Orders — get_next, get_last, get_delivered, get_all_delivered, get_detail
  • Delivery — get_info, get_timeslot_reservation, get_next_slots, get_announcements
  • Account — get_premium_profile, get_bags_info, get_announcements, get_shopping_list
  • Recipes (Rohlík Chef) — search, get_detail, get_ingredient_products
  • Aggregate — get_data() fetches account, delivery, orders, and cart in one call
  • Errors — RohlikAPIError, InvalidCredentialsError, APIRequestFailedError

Conventions

  • Read/optional fetches return None (and log a warning) on failure; lookups for resources that may not exist (e.g. a discontinued product) return None on HTTP 404.
  • Mutating/critical operations (login, cart changes, shopping-list fetch) raise APIRequestFailedError.
  • Used as an async context manager, the client logs in on entry and logs out + closes on exit.

Quality

  • 135 tests; ruff, black, and strict mypy all green on Python 3.13.