Browse Source

Merge pull request #1108 from octodns/no-utcnow

Address datetime.utcnow deprecation in py 3.12
pull/1112/head
Ross McFarland 2 years ago
committed by GitHub
parent
commit
1d8303c891
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions
  1. +9
    -1
      octodns/processor/meta.py
  2. +3
    -0
      pyproject.toml

+ 9
- 1
octodns/processor/meta.py View File

@ -10,6 +10,14 @@ from .. import __version__
from ..record import Record
from .base import BaseProcessor
# TODO: remove once we require python >= 3.11
try: # pragma: no cover
from datetime import UTC
except ImportError: # pragma: no cover
from datetime import timedelta, timezone
UTC = timezone(timedelta())
def _keys(values):
return set(v.split('=', 1)[0] for v in values)
@ -55,7 +63,7 @@ class MetaProcessor(BaseProcessor):
@classmethod
def now(cls):
return datetime.utcnow().isoformat()
return datetime.now(UTC).isoformat()
@classmethod
def uuid(cls):


+ 3
- 0
pyproject.toml View File

@ -9,4 +9,7 @@ known_first_party="octodns"
line_length=80
[tool.pytest.ini_options]
filterwarnings = [
'error',
]
pythonpath = "."

Loading…
Cancel
Save