Skip to content

Commit ddf563b

Browse files
mad4msclaude
andcommitted
fix: pass datetime objects to sessions API instead of ISO strings
`get_sessions_for_team` was calling `_to_iso()` which produced strings, but the generated `sync_detailed` client expects `datetime.datetime` objects and calls `.isoformat()` internally — causing an AttributeError. Bump version to 0.1.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a98e14f commit ddf563b

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "kinexon-handball-api"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "A Python wrapper for accessing and processing Kinexon Handball data."
55
authors = [
66
{ name = "Michael Adams", email = "m@ad4ms.de" }

src/kinexon_handball_api/handball.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ def _handle_response(
6363
return cast(T, response.parsed)
6464
return default
6565

66-
@staticmethod
67-
def _to_iso(value: datetime | str) -> str:
68-
return value.isoformat() if isinstance(value, datetime) else value
69-
7066
def get_team_ids(self, season: str | None = None) -> list[TeamEntry]:
7167
"""Return team IDs for a season (or default season behavior)."""
7268
return fetch_team_ids(season)
@@ -98,10 +94,17 @@ def get_sessions_for_team(
9894
end: datetime | str,
9995
) -> Any:
10096
self._require_value("team_id", team_id)
97+
98+
# Convert strings to datetime objects if necessary
99+
if isinstance(start, str):
100+
start = datetime.fromisoformat(start)
101+
if isinstance(end, str):
102+
end = datetime.fromisoformat(end)
103+
101104
resp = get_public_v1_teams_by_team_id_sessions_and_phases.sync_detailed(
102105
team_id=team_id,
103-
min_=self._to_iso(start),
104-
max_=self._to_iso(end),
106+
min_=start,
107+
max_=end,
105108
client=self.client,
106109
)
107110
return self._handle_response(resp, "sessions_for_team", {})

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)