Skip to content

Commit

Permalink
refactor: replace deprecated datetime.utcnow()
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Dec 15, 2024
1 parent 8ddbb3e commit 6c0f789
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/command/inner/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6c0f789

Please sign in to comment.