Taragolis commented on code in PR #37539:
URL: https://github.com/apache/airflow/pull/37539#discussion_r1494373192
##########
airflow/providers/google/common/hooks/base_google.py:
##########
@@ -674,7 +674,10 @@ async def acquire_access_token(self, timeout: int = 10) ->
None:
self.access_token = cast(str, self.credentials.token)
self.access_token_duration = 3600
- self.access_token_acquired_at =
datetime.datetime.now(tz=datetime.timezone.utc)
+ # access_token_acquired_at is specific to gcloud-aio's Token. On
subsequent calls of `get` it will be used
+ # with `datetime.datetime.utcnow()`. Therefore we have to use an
offset-naive datetime.
+ #
https://github.com/talkiq/gcloud-aio/blob/f1132b005ba35d8059229a9ca88b90f31f77456d/auth/gcloud/aio/auth/token.py#L204
+ self.access_token_acquired_at = datetime.datetime.utcnow() # noqa:
TID251
Review Comment:
noqa not an option here, since this related to the deprecated things in
Python
```suggestion
self.access_token_acquired_at =
datetime.datetime.now(tz=datetime.timezone.utc).replace(tzinfo=None)
```
##########
airflow/providers/google/common/hooks/base_google.py:
##########
@@ -674,7 +674,10 @@ async def acquire_access_token(self, timeout: int = 10) ->
None:
self.access_token = cast(str, self.credentials.token)
self.access_token_duration = 3600
- self.access_token_acquired_at =
datetime.datetime.now(tz=datetime.timezone.utc)
+ # access_token_acquired_at is specific to gcloud-aio's Token. On
subsequent calls of `get` it will be used
+ # with `datetime.datetime.utcnow()`. Therefore we have to use an
offset-naive datetime.
+ #
https://github.com/talkiq/gcloud-aio/blob/f1132b005ba35d8059229a9ca88b90f31f77456d/auth/gcloud/aio/auth/token.py#L204
Review Comment:
Just want to mention, that in 5.2 the type is changed to the aware:
https://github.com/talkiq/gcloud-aio/blob/4979115547cf07bc93878158e86263833e3839fc/auth/gcloud/aio/auth/token.py#L220
It is worthwhile to add this info into the `provider.yaml` for avoid
surprised when someone want to relax requirements
https://github.com/apache/airflow/blob/5a0be392e66f8e5426ba3478621115e92fcf245b/airflow/providers/google/provider.yaml#L92
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]