File tree 1 file changed +3
-3
lines changed
requests_toolbelt/adapters
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 14
14
from cryptography .hazmat .primitives .serialization import Encoding
15
15
from cryptography .hazmat .backends import default_backend
16
16
17
- from datetime import datetime
17
+ from datetime import datetime , timezone
18
18
from requests .adapters import HTTPAdapter
19
19
import requests
20
20
@@ -149,8 +149,8 @@ def _check_version(self):
149
149
def check_cert_dates (cert ):
150
150
"""Verify that the supplied client cert is not invalid."""
151
151
152
- now = datetime .utcnow ( )
153
- if cert .not_valid_after < now or cert .not_valid_before > now :
152
+ now = datetime .now ( timezone . utc )
153
+ if cert .not_valid_after_utc < now or cert .not_valid_before_utc > now :
154
154
raise ValueError ('Client certificate expired: Not After: '
155
155
'{:%Y-%m-%d %H:%M:%SZ} '
156
156
'Not Before: {:%Y-%m-%d %H:%M:%SZ}'
You can’t perform that action at this time.
0 commit comments