googleapis / googleapis/python-genai

DeprecationWarning: Inheritance class AiohttpClientSession from ClientSession is discouraged

Open
#1,989 3 comments 4 reactions 1 assignee Claimed by @Venkaiahbabuneelam View on GitHub
priority: p2 type: bug
Dominant language
Python
Stars
4k
Forks
1k
Avg merge
2d 11h
Merged PRs (30d)
40

Description

#### Environment details

- Programming language: `Python`
- OS: `Ubuntu 24.04.3 LTS`
- Language runtime version: `3.13.11`
- Package version: `1.60.0`

#### Steps to reproduce

1. Have `warnings.filterwarnings("error")` so that they get raised
2. Execute the following code
```py
warnings.filterwarnings("error")

gemini = Client(api_key=config_lookup("RANDOM_KEY"))
response = asyncio.run(
gemini.aio.models.generate_content(
model="gemini-2.5-flash",
contents="What is the capital of France?",
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(thinking_budget=0), # Disables thinking
),
)
)

print(response)
```
3. The following will get raised `DeprecationWarning: Inheritance class AiohttpClientSession from ClientSession is discouraged`

In our development environment, we also make sure to raise warnings as errors since we want to be aware of possible issues, like the one mentioned above.

As far as I can see, this particular Deprecation seems to have been in effect from 2018, [issue here](https://github.com/aio-libs/aiohttp/pull/2692)

For now our fix was to ignore the error, but it would probably be best to take care of it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.