Releases: dvejsada/rohlik_api_python
Releases · dvejsada/rohlik_api_python
Release list
v0.3.0 - Other Rohlík Group shops
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:czRohlík.cz,deKnuspr.de,atGurkerl.at,huKifli.hu,roSezamo.ro. Each hascode,name,base_url,currencyandtimezone. 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 isNonewhen the cart is empty or no item reports one (#10)Cart.minimum_order_price: the shop's minimum order value, fromminimalOrderPrice, which was previously dropped. It isNoneif the API omits it; anonymous carts report0(#9)
Changed
- The
Cart.can_make_orderdocstring no longer claims it tracks the minimum order.submitConditionPassedalso requires checkout details such as a delivery slot, so comparetotal_pricewithminimum_order_priceinstead. - Documentation (#12):
- The README now covers the other shops (new "Other shops" section) and documents
products.get_cards,products.get_week_sales,delivery.get_addressesanddelivery.get_active_address_id. - The README's error-handling section is complete.
example.pyshows how to pick a shop.PUBLISHING.mddescribes the real release flow.
- The README now covers the other shops (new "Other shops" section) and documents
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
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.addresscan benull),
which leftaddress_idunset and madedelivery.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/cardendpoint).products.get_week_sales()— this week's deals ("Akce týdne"),
enriched with product data in one follow-up request.ProductCardmodel — 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_idsetter — 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
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
RohlikAPIfacade.
Requirements
- Python 3.13+
aiohttp(installed automatically)
Installation
pip install rohlik-apiQuick 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) returnNoneon 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 strictmypyall green on Python 3.13.