-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
With the latest release of gcloud-aio-auth/storage (5.3.0) the following breaks when using aiohttp<3.9, which is allowed since the minimal required version is currently aiohttp>=3.3.0.
Potential fixes:
- Force
aiohttp>=3.9 - Set
allow_redirects=allow_redirectswhen setting up theself.ClientSessionobject in line 556 ofgcloud/aio/storage/storage.pyand remove from the.getcalls (and probably other places)
Code to reproduce with aiohttp==3.8.6:
from aiohttp import ClientSession
from gcloud.aio.storage import Storage
async with ClientSession() as session:
async with Storage(session=session) as client:
await client.download("test", "test")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 6
4 async with ClientSession() as session:
5 async with Storage(session=session) as client:
----> 6 await client.download("test", "test")
File ~/venvs/lib/python3.11/site-packages/gcloud/aio/storage/storage.py:329, in Storage.download(self, bucket, object_name, headers, timeout, session)
323 async def download(
324 self, bucket: str, object_name: str, *,
325 headers: Optional[Dict[str, Any]] = None,
326 timeout: int = DEFAULT_TIMEOUT,
327 session: Optional[Session] = None,
328 ) -> bytes:
--> 329 return await self._download(
330 bucket, object_name, headers=headers,
331 timeout=timeout, params={'alt': 'media'},
332 session=session,
333 )
File ~/venvs/lib/python3.11/site-packages/gcloud/aio/storage/storage.py:557, in Storage._download(self, bucket, object_name, params, headers, timeout, session)
554 headers.update(await self._headers())
556 s = AioSession(session) if session else self.session
--> 557 response = await s.get(
558 url, headers=headers, params=params or {},
559 timeout=timeout,
560 )
562 # N.B. the GCS API sometimes returns 'application/octet-stream' when a
563 # string was uploaded. To avoid potential weirdness, always return a
564 # bytes object.
565 try:
File ~/venvs/lib/python3.11/site-packages/gcloud/aio/auth/session.py:214, in AioSession.get(self, url, headers, timeout, params, stream, auto_decompress)
208 if stream is not None:
209 log.warning(
210 'passed unused argument stream=%s to AioSession: '
211 'this argument is only used by SyncSession',
212 stream,
213 )
--> 214 resp = await self.session.get(
215 url, headers=headers,
216 timeout=timeout, params=params,
217 auto_decompress=auto_decompress,
218 )
219 await _raise_for_status(resp)
220 return resp
File ~/venvs/lib/python3.11/site-packages/aiohttp/client.py:922, in ClientSession.get(self, url, allow_redirects, **kwargs)
917 def get(
918 self, url: StrOrURL, *, allow_redirects: bool = True, **kwargs: Any
919 ) -> "_RequestContextManager":
920 """Perform HTTP GET request."""
921 return _RequestContextManager(
--> 922 self._request(hdrs.METH_GET, url, allow_redirects=allow_redirects, **kwargs)
923 )
TypeError: ClientSession._request() got an unexpected keyword argument 'auto_decompress'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels