diff --git a/auth/gcloud/aio/auth/session.py b/auth/gcloud/aio/auth/session.py index dff6b0856..646739dcc 100644 --- a/auth/gcloud/aio/auth/session.py +++ b/auth/gcloud/aio/auth/session.py @@ -1,6 +1,7 @@ import importlib.metadata import logging import threading +import warnings from abc import ABCMeta from abc import abstractmethod from abc import abstractproperty @@ -54,6 +55,7 @@ async def get( self, url: str, headers: Optional[Mapping[str, str]], timeout: float, params: Optional[Mapping[str, Union[int, str]]], stream: bool, + auto_decompress: bool, ) -> Response: pass @@ -198,6 +200,7 @@ async def get( # type: ignore[override] timeout: Timeout = 10, params: Optional[Mapping[str, Union[int, str]]] = None, stream: Optional[bool] = None, + auto_decompress: bool = True, ) -> aiohttp.ClientResponse: if not isinstance(timeout, aiohttp.ClientTimeout): timeout = aiohttp.ClientTimeout(total=timeout) @@ -211,6 +214,7 @@ async def get( # type: ignore[override] resp = await self.session.get( url, headers=headers, timeout=timeout, params=params, + auto_decompress=auto_decompress, ) await _raise_for_status(resp) return resp @@ -335,7 +339,17 @@ async def get( timeout: float = 10, params: Optional[Mapping[str, Union[int, str]]] = None, stream: bool = False, + auto_decompress: bool = True, ) -> Response: + if not auto_decompress and not stream: + warnings.warn( + 'the requests library always decompresses responses when ' + 'outside of streaming mode; when audo_decompress is ' + 'False, stream = True must also be set', + UserWarning, + ) + stream = True + with self.google_api_lock: resp = self.session.get( url, headers=headers, timeout=timeout, diff --git a/auth/poetry.rest.lock b/auth/poetry.rest.lock index 9c5412cf5..98011249b 100644 --- a/auth/poetry.rest.lock +++ b/auth/poetry.rest.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "backoff" @@ -325,13 +325,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pycparser" -version = "2.21" +version = "2.22" description = "C parser in Python" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.8" files = [ - {file = "pycparser-2.21-py2.py3-none-any.whl", hash = "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9"}, - {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, + {file = "pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc"}, + {file = "pycparser-2.22.tar.gz", hash = "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6"}, ] [[package]] @@ -375,17 +375,17 @@ testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygm [[package]] name = "pytest-mock" -version = "3.12.0" +version = "3.14.0" description = "Thin-wrapper around the mock package for easier use with pytest" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-mock-3.12.0.tar.gz", hash = "sha256:31a40f038c22cad32287bb43932054451ff5583ff094bca6f675df2f8bc1a6e9"}, - {file = "pytest_mock-3.12.0-py3-none-any.whl", hash = "sha256:0972719a7263072da3a21c7f4773069bcc7486027d7e8e1f81d98a47e701bc4f"}, + {file = "pytest-mock-3.14.0.tar.gz", hash = "sha256:2719255a1efeceadbc056d6bf3df3d1c5015530fb40cf347c0f9afac88410bd0"}, + {file = "pytest_mock-3.14.0-py3-none-any.whl", hash = "sha256:0b72c38033392a5f4621342fe11e9219ac11ec9d375f8e2a0c164539e0d70f6f"}, ] [package.dependencies] -pytest = ">=5.0" +pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] @@ -442,4 +442,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = ">= 3.8, < 4.0" -content-hash = "ff6f080b1cdcf07dd2285eb123053d94676b1e95edababecee8ea1447b981958" +content-hash = "1fe9a474cdf13c08c86dfd7155039849028f39a456783a75b8f5eb6b6fa8270e" diff --git a/auth/pyproject.rest.toml b/auth/pyproject.rest.toml index 728fc53fa..d63ad6064 100644 --- a/auth/pyproject.rest.toml +++ b/auth/pyproject.rest.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "gcloud-rest-auth" -version = "5.2.2" +version = "5.3.0" description = "Python Client for Google Cloud Auth" readme = "README.rst" @@ -31,8 +31,8 @@ requests = ">= 2.2.1, < 3.0.0" [tool.poetry.group.dev.dependencies] pytest = "8.1.1" -# pytest-asyncio = "0.23.5" -pytest-mock = "3.12.0" +# pytest-asyncio = "0.23.6" +pytest-mock = "3.14.0" [[tool.poetry.source]] name = "pypi" diff --git a/auth/pyproject.toml b/auth/pyproject.toml index c1e87219d..18f68cc68 100644 --- a/auth/pyproject.toml +++ b/auth/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "gcloud-aio-auth" -version = "5.2.2" +version = "5.3.0" description = "Python Client for Google Cloud Auth" readme = "README.rst"