Skip to content

Resolve delivery address_id from address list for timeslots - #5

Merged
dvejsada merged 1 commit into
mainfrom
claude/mcp-server-pypi-package-3n714c
Jun 28, 2026
Merged

dvejsada merged 1 commit into
mainfrom
claude/mcp-server-pypi-package-3n714c

Conversation

@dvejsada

Copy link
Copy Markdown
Owner

Summary

Fixes delivery.get_next_slots() returning None for accounts whose login response doesn't carry a delivery address.

The Rohlik login response does not always include an address — data.address is null for some accounts — so user_id is populated but address_id stays None, and get_next_slots() can't build the timeslots URL (it logs "User ID or Address ID not available for timeslots request" and returns None). The Home Assistant integration has the same latent gap; it only kept working because a long-lived client cached an address_id from an earlier login.

Changes

  • Add Endpoints.DELIVERY_ADDRESS_LIST → /services/frontend-service/delivery-address/list.
  • Add delivery.get_addresses() — returns the account's saved delivery addresses.
  • Add delivery.get_active_address_id() — resolves the address id to use, preferring the first address flagged isDeliveredTo, falling back to the first.
  • delivery.get_next_slots() now falls back to the resolved address when login didn't supply one, and caches it on the auth manager (new AuthManager.address_id setter) so subsequent polls are a single request.
  • Bump version 0.1.0 → 0.2.0.

Tests

Added regression tests (built from the real /delivery-address/list payload shape) covering get_addresses, get_active_address_id preference order, and get_next_slots resolving + caching the address. Full suite: 138 passed, ruff/black/mypy clean.

Verification note

The live login endpoint bot-blocks this CI/datacenter IP (returns 202 instead of 200), so end-to-end validation was done with mocked responses using the real payload. Final live confirmation (timeslots returns slots for the resolved address id) is being verified from a residential connection before release.

🤖 Generated with Claude Code


Generated by Claude Code

The login response does not always include a delivery address (data.address
is null for some accounts), leaving user_id present but address_id None, so
get_next_slots could not build the timeslots URL and returned None.

Add delivery.get_addresses() and get_active_address_id() backed by the
/delivery-address/list endpoint, and have get_next_slots fall back to the
resolved address (preferring isDeliveredTo) and cache it on the auth
manager. Bump version to 0.2.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KXnkpGcLfWU4p12TcZjfY
@dvejsada
dvejsada merged commit 1f432ea into main Jun 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants