Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ repos:
# `types-$lib` or `$lib-stubs`.
additional_dependencies:
- aiohttp==3.13.3
- backoff==2.2.1
- cryptography==46.0.6
- pyjwt==2.12.1
- tenacity==9.1.2
- types-requests==2.32.4.20260324
args:
- --show-error-codes
Expand Down
12 changes: 10 additions & 2 deletions auth/gcloud/aio/auth/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
from urllib.parse import urlencode
from urllib.parse import urlparse

import backoff
import cryptography # pylint: disable=unused-import
import jwt
from tenacity import retry
from tenacity import retry_if_exception_type
from tenacity import stop_after_attempt
from tenacity import wait_random_exponential

from .build_constants import BUILD_GCLOUD_REST
from .session import AioSession
Expand Down Expand Up @@ -276,7 +279,12 @@ async def ensure_token(self) -> None:
async def refresh(self, *, timeout: int) -> TokenResponse:
pass

@backoff.on_exception(backoff.expo, Exception, max_tries=5)
@retry(
retry=retry_if_exception_type(Exception),
stop=stop_after_attempt(5),
wait=wait_random_exponential(multiplier=1, max=60),
reraise=True,
)
async def acquire_access_token(self, timeout: int = 10) -> None:
resp = await self.refresh(timeout=timeout)

Expand Down
38 changes: 21 additions & 17 deletions auth/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

298 changes: 161 additions & 137 deletions auth/poetry.rest.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions auth/pyproject.rest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ classifiers = [
[tool.poetry.dependencies]
python = ">= 3.10, < 4.0"
# aiohttp = ">= 3.9.2, < 4.0.0"
backoff = ">= 1.0.0, < 3.0.0"
chardet = ">= 2.0, < 7.0"
chardet = ">= 2.0, < 6.0"
# See https://cryptography.io/en/latest/api-stability/#deprecation
cryptography = ">= 2.0.0, < 49.0.0" # pin max to < (major + 3)
pyjwt = ">= 1.5.3, < 3.0.0"
requests = ">= 2.2.1, < 3.0.0"
tenacity = ">= 8.2.0, < 10.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "9.0.2"
Expand Down
4 changes: 2 additions & 2 deletions auth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ classifiers = [
[tool.poetry.dependencies]
python = ">= 3.10, < 4.0"
aiohttp = ">= 3.9.2, < 4.0.0"
backoff = ">= 1.0.0, < 3.0.0"
chardet = ">= 2.0, < 7.0"
chardet = ">= 2.0, < 6.0"
# See https://cryptography.io/en/latest/api-stability/#deprecation
cryptography = ">= 2.0.0, < 49.0.0" # pin max to < (major + 3)
pyjwt = ">= 1.5.3, < 3.0.0"
# requests = ">= 2.2.1, < 3.0.0"
tenacity = ">= 8.2.0, < 10.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "9.0.2"
Expand Down
Loading