swagger-api / swagger-api/swagger-codegen

[python] asyncio aiohttp.ClientSession doesn't have proxy in __init__

Open
#9,995 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

proxy is not a valid argument to aiohttp.ClientSession. As far as I can tell, it hasn't ever been -- which makes this even more confusing, since that means this has always been wrong?

Swagger-codegen version

current

Swagger declaration file content or url

The python asyncio rest.py template is invalid

https://github.com/swagger-api/swagger-codegen/blob/5a9f449d1eacd7c840c92b80f0bbbc2c86fb6335/modules/swagger-codegen/src/main/resources/python/asyncio/rest.mustache#L63-L67

Command line used for generation

--library asyncio

Steps to reproduce

Generate any async code

Related issues/PRs

None

Suggest a fix/enhancement

aiohttp.ClientSession doesn't take a proxy (although it might at some point). However, session.request does. So, possibly, just store the proxy info as part of RESTClientObject and pass it along to request in args here

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules/swagger-codegen/src/main/resources/python/asyncio/rest.mustache, especially lines 63-67 and the request call near line 155. Generate any async code with --library asyncio and verify the generated code no longer passes proxy to aiohttp.ClientSession; proxy handling should instead be passed to session.request if supported by the template.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.