Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Use timezone-aware datetime.datetime.now()#805

Open
4n3w wants to merge 1 commit intosivel:masterfrom
4n3w:fix_datetime_utcnow_deprecation
Open

Use timezone-aware datetime.datetime.now()#805
4n3w wants to merge 1 commit intosivel:masterfrom
4n3w:fix_datetime_utcnow_deprecation

Conversation

@4n3w
Copy link

@4n3w 4n3w commented Apr 12, 2024

Replace deprecated datetime.datetime.utcnow() with timezone-aware datetime.datetime.now()

This change addresses a deprecation warning for python 3.12 by using datetime.datetime.now() with datetime.timezone.utc, ensuring the timestamp remains in UTC and conforms to newer best practices.

Copy link

@kovyrin kovyrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it in my environment and it works

@senderic
Copy link

Works for me too

~ curl https://raw.githubusercontent.com/4n3w/speedtest-cli/fix_datetime_utcnow_deprecation/speedtest.py | python3 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 65352 100 65352 0 0 263k 0 --:--:-- --:--:-- --:--:-- 263k Retrieving speedtest.net configuration... Testing from Spectrum (a.b.c.d)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by Airlink Internet Inc (Los Angeles, CA) [167.30 km]: 20.176 ms Testing download speed................................................................................ Download: 196.26 Mbit/s Testing upload speed...................................................................................................... Upload: 10.62 Mbit/s
@4n3w
Copy link
Author

4n3w commented Aug 19, 2024

I guess someone with write access would have to merge this, summoning @sivel

@SantiiRepair
Copy link

image

you should update that too

@ckujau
Copy link

ckujau commented Sep 20, 2024

duplicate of #801 (and would be included in #799 also)?

@teddy931130
Copy link

hey guys, just FYI this is still a thing:

image
@SantiiRepair
Copy link

SantiiRepair commented Feb 8, 2025 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

7 participants