Skip to content
Snippets Groups Projects
Commit 525482b5 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Reject time parameters that are not datetime, date or string

parent 0399fbb3
No related branches found
No related tags found
1 merge request!885Revised CalCat API
...@@ -57,6 +57,11 @@ class CalCatAPIClient: ...@@ -57,6 +57,11 @@ class CalCatAPIClient:
return dt.astimezone(timezone.utc).isoformat() return dt.astimezone(timezone.utc).isoformat()
elif isinstance(dt, date): elif isinstance(dt, date):
return cls.format_time(datetime.combine(dt, time())) return cls.format_time(datetime.combine(dt, time()))
elif not isinstance(dt, str):
raise TypeError(
f"Timestamp parameter ({dt!r}) must be a string, datetime or "
f"date object"
)
return dt return dt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment