From 31db1ad426c1c372da8190f8f07690dd267c211d Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Wed, 23 Dec 2020 11:36:16 +0000 Subject: [PATCH] use python3.7 builtin function to properly parse iso8601 --- fahrplan.py | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/fahrplan.py b/fahrplan.py index 84cb85d..ec1eff9 100644 --- a/fahrplan.py +++ b/fahrplan.py @@ -122,7 +122,7 @@ def events(scheduleUrl, titlemap={}): if __name__ == "__main__": events = list(events(scheduleUrl)) - events = sorted(events, key=lambda x: datetime.datetime.strptime(x["datetime"], "%Y-%m-%dT%H:%M:%S%z")) + events = sorted(events, key=lambda x: datetime.datetime.fromisoformat(x["datetime"])) with open("fahrplan.json", "w") as f: json.dump(events, f) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ab90481 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +lxml