Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ This library is published under the [GNU Lesser General Public License v2.1](htt

## Changelog

* version 0.8 dated 2026-06-09

* search\_flows\_parsed() now accepts updated\_after as datetime object (timezone aware or timezone naive as UTC)

* version 0.7 dated 2026-05-28 ([OCA code sprint in Santander](https://www.aeodoo.org/event/spanish-oca-days-2026-143/page/introduccion-spanish-oca-days-2026))

* Restore method get\_session()
Expand Down Expand Up @@ -49,5 +53,3 @@ This library is published under the [GNU Lesser General Public License v2.1](htt
* version 0.1 dated 2026-04-22

* initial release


18 changes: 17 additions & 1 deletion src/pyfrctc/pyfrctc.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,14 @@ def search_flows(
raise ValueError("session argument has no value")
if not updated_after:
raise ValueError("updated_after argument must have a value")
# TODO add check for updated_after ?
if not isinstance(updated_after, str):
raise ValueError("updated_after argument must be a timestamp as string")
if not updated_after.endswith("Z"):
raise ValueError(
"updated_after argument must be a timestamp as string in UTC, "
"so it should end with 'Z'"
)

if flow_direction:
if isinstance(flow_direction, str):
flow_direction = [flow_direction]
Expand Down Expand Up @@ -970,6 +977,15 @@ def search_flows_parsed(
flow_direction = flow_direction.capitalize()
elif isinstance(flow_direction, list):
flow_direction = [x.capitalize() for x in flow_direction]
if isinstance(updated_after, datetime.datetime):
if updated_after.tzinfo: # tz aware
updated_after_utc_aware = updated_after.astimezone(pytz.utc)
else: # tz naive, we suppose it is UTC
updated_after_utc_aware = pytz.utc.localize(updated_after)
updated_after = updated_after_utc_aware.isoformat(timespec="milliseconds")
if updated_after.endswith("+00:00"):
updated_after = f"{updated_after[:-6]}Z"
logger.debug(f"updated_after converted to string: {updated_after}")
res = search_flows(
session, updated_after, flow_direction, flow_type, updated_before=updated_before
)
Expand Down
Loading