Skip to content

Commit

Permalink
Update for newer versions of python and pywikibot
Browse files Browse the repository at this point in the history
  • Loading branch information
Facenapalm committed Oct 8, 2024
1 parent dfd6b65 commit 3190795
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
apicache
apicache-py3
keys
steam_cache
Expand Down
4 changes: 2 additions & 2 deletions common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import re
import pywikibot
from datetime import datetime
from datetime import datetime, UTC
from pywikibot import pagegenerators as pg

def get_first_key(dictionary):
Expand All @@ -31,7 +31,7 @@ def get_first_key(dictionary):

def get_current_wbtime():
"""Return current UTC time as an pywikibot.WbTime object."""
timestamp = datetime.utcnow()
timestamp = datetime.now(UTC)
return pywikibot.WbTime(year=timestamp.year, month=timestamp.month, day=timestamp.day)

def get_only_value(item, prop, label='claim'):
Expand Down
4 changes: 2 additions & 2 deletions steam_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import re
import argparse
import os.path
from datetime import datetime
from datetime import datetime, UTC

import pywikibot
from pywikibot.data.sparql import SparqlQuery
Expand Down Expand Up @@ -352,7 +352,7 @@ def __init__(self, steam_id, bypass_cache=False):
raise RuntimeError(f"{match.group(1)} ({steam_id})")
if "<title>Welcome to Steam</title>" in html:
raise RuntimeError(f"Redirected to the main page ({steam_id})")
retrieve_date = datetime.utcnow()
retrieve_date = datetime.now(UTC)
print(f"{steam_id}: HTML downloaded")
self.cache_used = False

Expand Down

0 comments on commit 3190795

Please sign in to comment.