From 6c0f7897d6ca2210497ce8964ab98993e10c95ea Mon Sep 17 00:00:00 2001 From: Rongrong Date: Mon, 16 Dec 2024 00:52:50 +0800 Subject: [PATCH] refactor: replace deprecated datetime.utcnow() Signed-off-by: Rongrong --- src/command/inner/sub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/inner/sub.py b/src/command/inner/sub.py index aa271e8508..86930ee931 100644 --- a/src/command/inner/sub.py +++ b/src/command/inner/sub.py @@ -20,7 +20,7 @@ import re import asyncio -from datetime import datetime +from datetime import datetime, timezone from bs4 import BeautifulSoup from bs4.element import SoupStrainer from urllib.parse import urljoin @@ -298,7 +298,7 @@ async def export_opml(user_id: int) -> Optional[bytes]: sub_list = await list_sub(user_id) opml = BeautifulSoup(OPML_TEMPLATE, 'lxml-xml') create_time = opml.new_tag('dateCreated') - create_time.string = opml.new_string(datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S UTC')) + create_time.string = opml.new_string(datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S UTC')) opml.head.append(create_time) empty_flags = True for _sub in sub_list: