Skip to content

Commit

Permalink
Switch from deprecated datetime.utcnow()
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Mar 25, 2024
1 parent 2075359 commit 142d78e
Showing 1 changed file with 5 additions and 5 deletions.
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 @@ -189,8 +189,8 @@ def generate_certificates(cert_dir: Path) -> Dict[str, 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 @@ -207,8 +207,8 @@ def generate_certificates(cert_dir: Path) -> Dict[str, 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

0 comments on commit 142d78e

Please sign in to comment.