Replace datetime.utcnow(), it is deprecated
This commit is contained in:
parent
26c8ef7b14
commit
2ade1eee5e
|
@ -7,7 +7,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timezone
|
||||||
|
|
||||||
import ics # type: ignore
|
import ics # type: ignore
|
||||||
import jinja2
|
import jinja2
|
||||||
|
@ -194,8 +194,7 @@ def main() -> None:
|
||||||
with open(ics_file, "w") as fh:
|
with open(ics_file, "w") as fh:
|
||||||
fh.write(cal.serialize())
|
fh.write(cal.serialize())
|
||||||
|
|
||||||
now = datetime.utcnow() # need to rewrite this, utcnow is deprecated
|
now_str = datetime.now(timezone.utc).strftime("%Y-%m-%d_%H:%M")
|
||||||
now_str = now.strftime("%Y-%m-%d_%H:%M")
|
|
||||||
filename = os.path.join(data_dir, now_str + ".html")
|
filename = os.path.join(data_dir, now_str + ".html")
|
||||||
with open(filename, "w") as fh:
|
with open(filename, "w") as fh:
|
||||||
fh.write(page)
|
fh.write(page)
|
||||||
|
|
Loading…
Reference in a new issue