Skip to content

DeprecationWarning: Inheritance class AiohttpClientSession from ClientSession is discouraged #1989

@sdediu00

Description

@sdediu00

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
    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)
  1. 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

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

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions