Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Add
Surepy.get_household_timeline_page(household_id, *, before_id=None)for the newest 25 timeline records, or the page preceding a source event ID. Return the API dictionaries without dropping unknown event types or timestamps. Existing timeline and reporting methods retain their interfaces.The HTTP client gains an opt-in
raise_on_errorflag. Unexpected HTTP statuses raiseSurePetcareErrorin this mode, so callers cannot confuse HTTP failures with an empty page or a cached 304 result. The new method validates the page shape and event IDs before returning it.Motivation
Home Assistant needs a stable source cursor to catch up after an interruption without replaying all history on first activation. Keeping URL construction, ETag handling and transport errors inside the library avoids duplicating API internals in HA.
Validation
15 offline tests in
tests/test_timeline.py: newest/older page URLs, preservation of unknown types and source timestamps, empty/malformed responses (including actual HTTP JSON decoding paths), cached 304, HTTP 500/429, authentication failure and compatibility of the legacy method. No real account credentials are used.Review points
Please confirm that
before_idand fixed page size 25 are suitable as a supported public API, and the opt-in HTTP error behavior is acceptable. A released version is required before the HA dependency update and feature can be submitted.