Skip to content

Commit

Permalink
Replace deprecated datetime.utcnow and datetime.utcfromtimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Dec 13, 2023
1 parent 6332f4b commit d6b868f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions qwc_services_core/tenant_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
import datetime
import os
import re
from flask import request
Expand Down Expand Up @@ -115,7 +115,7 @@ def register_handler(self, handler_name, tenant, handler):
self.handler_cache[handler_name] = handlers
handlers[tenant] = {
'handler': handler,
'last_update': datetime.utcnow()
'last_update': datetime.datetime.now(datetime.UTC)
}
return handler

Expand All @@ -133,8 +133,9 @@ def last_config_update(self, service_name, tenant):
]
for path in paths:
if os.path.isfile(path):
timestamp = datetime.utcfromtimestamp(
os.path.getmtime(path)
timestamp = datetime.datetime.fromtimestamp(
os.path.getmtime(path),
datetime.UTC
)
if (
last_config_update is None
Expand Down

0 comments on commit d6b868f

Please sign in to comment.