Skip to content

Usage of httpx.Client() in order to manage session between API Calls #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jpjoux opened this issue Apr 26, 2023 · 1 comment
Closed
Labels
🐞bug Something isn't working

Comments

@jpjoux
Copy link

jpjoux commented Apr 26, 2023

Describe the bug
The code generated is not able to connect through https to a server hosted behind an ALB/proxy by using the same session.
Each API request is done by executing httpx.request(....) and so all requests are session less. Being session less, the load balancer is not able to address the same server between API calls.

To Reproduce
N/A

Expected behavior
Provide into the Client class (client.py) a mean for initializing a session (If you are coming from Requests, httpx.Client() is what you can use instead of requests.Session()) and use this session in all api calls

Currently it is like in API Call

response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)

after (or equivalent), it can be like

response = session.request(
    verify=client.verify_ssl,
    **kwargs,
)

OpenAPI Spec File
N/A

Desktop (please complete the following information):
N/A

Additional context

@jpjoux jpjoux added the 🐞bug Something isn't working label Apr 26, 2023
@emann
Copy link
Collaborator

emann commented Apr 27, 2023

This is a known limitation (currently!) of the generated clients - see #202.

@emann emann closed this as completed Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants