diff --git a/pwnedadmin/utils.py b/pwnedadmin/utils.py index bcf2da9..8f9597e 100644 --- a/pwnedadmin/utils.py +++ b/pwnedadmin/utils.py @@ -1,7 +1,7 @@ from datetime import datetime, timezone def get_current_utc_time(): - return datetime.now(timezone.utc) + return datetime.now(tz=timezone.utc) def get_local_from_utc(dtg): return dtg.replace(tzinfo=timezone.utc).astimezone(tz=None) diff --git a/pwnedapi/utils.py b/pwnedapi/utils.py index fe4956e..9a1e5e3 100644 --- a/pwnedapi/utils.py +++ b/pwnedapi/utils.py @@ -10,7 +10,7 @@ import requests def get_current_utc_time(): - return datetime.now(timezone.utc) + return datetime.now(tz=timezone.utc) def get_local_from_utc(dtg): return dtg.replace(tzinfo=timezone.utc).astimezone(tz=None) diff --git a/pwnedapi/views/api.py b/pwnedapi/views/api.py index a248bea..f197b5c 100644 --- a/pwnedapi/views/api.py +++ b/pwnedapi/views/api.py @@ -6,7 +6,7 @@ from pwnedapi.models import Config, Email, User, Note, Message, Tool, Scan, Room from pwnedapi.utils import get_current_utc_time, generate_code, get_bearer_token, encode_jwt, decode_jwt, unfurl_url, CsrfToken from pwnedapi.validators import is_valid_command -from datetime import datetime +from datetime import datetime, timezone from sqlalchemy import select, text from sqlalchemy.exc import SQLAlchemyError, PendingRollbackError import jwt @@ -299,10 +299,10 @@ def get(self, rid): } cursor = float(request.args.get('cursor', get_current_utc_time().timestamp())) size = request.args.get('size', 8) - messages = room.messages.filter(Message.created < datetime.fromtimestamp(cursor)).order_by(Message.created.desc()).all() + messages = room.messages.filter(Message.created < datetime.fromtimestamp(cursor, tz=timezone.utc)).order_by(Message.created.desc()).all() if messages: paged_messages = messages[:size] - next_cursor = str(paged_messages[-1].created.timestamp()) + next_cursor = str(paged_messages[-1].created.replace(tzinfo=timezone.utc).timestamp()) next_url = None if messages[-1].created < paged_messages[-1].created: next_url = url_for('resources.roommessagelist', rid=room.id, cursor=next_cursor, _external=True) diff --git a/pwnedhub/utils.py b/pwnedhub/utils.py index 8c42087..eb0736f 100644 --- a/pwnedhub/utils.py +++ b/pwnedhub/utils.py @@ -11,7 +11,7 @@ import requests def get_current_utc_time(): - return datetime.now(timezone.utc) + return datetime.now(tz=timezone.utc) def get_local_from_utc(dtg): return dtg.replace(tzinfo=timezone.utc).astimezone(tz=None) diff --git a/pwnedsso/utils.py b/pwnedsso/utils.py index f209b02..0a2dc4c 100644 --- a/pwnedsso/utils.py +++ b/pwnedsso/utils.py @@ -5,7 +5,7 @@ import jwt def get_current_utc_time(): - return datetime.now(timezone.utc) + return datetime.now(tz=timezone.utc) def get_local_from_utc(dtg): return dtg.replace(tzinfo=timezone.utc).astimezone(tz=None)