Skip to content

Commit ecfa90c

Browse files
yinghsienwucopybara-github
authored andcommitted
chore: internal change
PiperOrigin-RevId: 874776971
1 parent 61aec34 commit ecfa90c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

google/genai/_api_client.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,7 @@ async def __anext__(self) -> Any:
267267

268268
@property
269269
def json(self) -> Any:
270-
# Handle case where response_stream is not a list (e.g., aiohttp.ClientResponse)
271-
# This can happen when the API returns an error and the response object
272-
# is passed directly instead of being wrapped in a list.
273-
# See: https://github.com/googleapis/python-genai/issues/1897
274-
if not isinstance(self.response_stream, list):
275-
return None
276-
if not self.response_stream or not self.response_stream[0]: # Empty response
270+
if not self.response_stream[0]: # Empty response
277271
return ''
278272
return self._load_json_from_response(self.response_stream[0])
279273

google/genai/tests/client/test_http_options.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ def test_patch_http_options_with_copies_all_fields():
4040

4141
for key in http_options_keys:
4242
assert hasattr(patched, key)
43-
if key not in ['httpx_client', 'httpx_async_client', 'aiohttp_client']:
43+
if key not in [
44+
'httpx_client',
45+
'httpx_async_client',
46+
'aiohttp_client',
47+
]:
4448
assert getattr(patched, key) is not None
4549
assert patched.base_url == 'https://fake-url.com/'
4650
assert patched.api_version == 'v1'

0 commit comments

Comments
 (0)