GoogleCloudPlatform / alloydb-python-connector

A Python library for connecting securely to your AlloyDB instances.
Apache License 2.0
28 stars 7 forks source link

chore: use new `not_valid_after_utc` cert field #261

Closed jackwotherspoon closed 7 months ago

jackwotherspoon commented 7 months ago

In cryptography v42.0.0 the not_valid_after_utc field was added to certs. This allows us to pull the aware datetime cert expiry instead of the naive one which is slowly being deprecated.

This will help to remove a deprecation warning that is currently being outputted:

alloydb-python-connector/google/cloud/alloydb/connector/refresh.py:99: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to not_valid_after_utc.
  self.expiration = cert_obj.not_valid_after.replace(tzinfo=timezone.utc)

Closes #206