Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from deprecated datetime.utcnow() #413

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions grizzly/common/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
from datetime import datetime, timedelta, timezone
from enum import IntEnum, unique
from importlib.metadata import PackageNotFoundError, version
from ipaddress import IPv4Address
Expand Down Expand Up @@ -180,8 +180,8 @@ def generate_certificates(cert_dir: Path):
.public_key(root_key.public_key())
.add_extension(x509.BasicConstraints(ca=True, path_length=None), critical=True)
.serial_number(x509.random_serial_number())
.not_valid_before(datetime.datetime.utcnow())
.not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=30))
.not_valid_before(datetime.now(timezone.utc))
.not_valid_after(datetime.now(timezone.utc) + timedelta(days=30))
.sign(root_key, hashes.SHA256(), default_backend())
)

Expand All @@ -198,8 +198,8 @@ def generate_certificates(cert_dir: Path):
.issuer_name(root_cert.issuer)
.public_key(host_key.public_key())
.serial_number(x509.random_serial_number())
.not_valid_before(datetime.datetime.utcnow())
.not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=30))
.not_valid_before(datetime.now(timezone.utc))
.not_valid_after(datetime.now(timezone.utc) + timedelta(days=30))
.add_extension(
x509.SubjectAlternativeName(
[
Expand Down
Loading