Skip to content

Commit

Permalink
Replace deprecated datetime function
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCommanderFort committed Aug 13, 2024
1 parent d07fe28 commit 1c2b96b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion process_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def update_wiki(reddit: Reddit):
)
id_extractor = re.compile(r'/comments/([^/]*)/')
for post in all_posts:
wiki_text += f'| {post[1] if len(post[1]) < 30 else ("[" + post[1][:30] + "...](" + post[1] + ")")} | {datetime.datetime.utcfromtimestamp(post[2]).strftime("%b %d, %Y %I:%M %p")} | https://redd.it/{id_extractor.search(post[0]).group(1)} |\n'
wiki_text += f'| {post[1] if len(post[1]) < 30 else ("[" + post[1][:30] + "...](" + post[1] + ")")} | {datetime.datetime.fromtimestamp(post[2], tz=datetime.UTC).strftime("%b %d, %Y %I:%M %p")} | https://redd.it/{id_extractor.search(post[0]).group(1)} |\n'

repostspage = subreddit_wiki['posts']
repostspage.edit(content=wiki_text)
Expand Down
2 changes: 1 addition & 1 deletion update_common_reposts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

config = json.load(open('config.json'))

print(datetime.datetime.utcfromtimestamp(int(time.time())).strftime("%b %d, %Y %I:%M %p"))
print(datetime.datetime.fromtimestamp(int(time.time()), tz=datetime.UTC).strftime("%b %d, %Y %I:%M %p"))
print(str(b'test', 'utf-8'))


Expand Down

0 comments on commit 1c2b96b

Please sign in to comment.