Skip to content

Commit

Permalink
Replaced the 'datetime.utcnow()' method with 'datetime.now(timezone.u…
Browse files Browse the repository at this point in the history
…tc)'
  • Loading branch information
guriWiz committed Apr 21, 2024
1 parent 7a92bf1 commit 8348161
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/betamax/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from . import cassette
from .exceptions import BetamaxError
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from requests.adapters import BaseAdapter, HTTPAdapter

_SENTINEL = object()
Expand Down Expand Up @@ -102,7 +102,7 @@ def load_cassette(self, cassette_name, serialize, options):
if self.options.get('re_record_interval'):
re_record_interval = timedelta(self.options['re_record_interval'])

now = datetime.utcnow()
now = datetime.now(timezone.utc)
if re_record_interval < (now - self.cassette.earliest_recorded_date):
self.cassette.clear()

Expand Down
4 changes: 2 additions & 2 deletions src/betamax/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .mock_response import MockHTTPResponse
from datetime import datetime
from datetime import datetime, timezone
from requests.models import PreparedRequest, Response
from requests.packages.urllib3 import HTTPResponse
from requests.structures import CaseInsensitiveDict
Expand Down Expand Up @@ -163,7 +163,7 @@ def add_urllib3_response(serialized, response, headers):


def timestamp():
stamp = datetime.utcnow().isoformat()
stamp = datetime.now(timezone.utc).isoformat().split("+")[0]
try:
i = stamp.rindex('.')
except ValueError:
Expand Down

0 comments on commit 8348161

Please sign in to comment.