Skip to content
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

Possibility to pass base_url parameter in request methods #10187

Closed
1 task done
rnv812 opened this issue Dec 21, 2024 · 2 comments
Closed
1 task done

Possibility to pass base_url parameter in request methods #10187

rnv812 opened this issue Dec 21, 2024 · 2 comments

Comments

@rnv812
Copy link

rnv812 commented Dec 21, 2024

Is your feature request related to a problem?

I have a scenario where for each request I need to change host (post bulk requests to ElasticSearch cluster nodes).

Describe the solution you'd like

It would be nice to be able to pass base_url as request method argument that has priority over base_url initialized from __init__. All the logic of joining urls is delegated to library.

Describe alternatives you've considered

  • I think to set it via assignment to session._base_url protected attribute is not possibly safe way due to asynchronous execution.

  • We could also use url parameter to build full url, but in this case we can encounter next problems:
    image

  • Also we could create yarl.URL objects for parts of URL, joining them and pass to url parametersr, but as I said before I think this logic should be delegated to library.

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@Dreamsorcerer
Copy link
Member

Adding a base_url parameter sounds like a weird design.
Anyway, I think #10074 in 3.12 will solve your issue, just pass the full URL.

@rnv812
Copy link
Author

rnv812 commented Dec 23, 2024

Ok, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants