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

Support HTTPX cli #114

Open
karpetrosyan opened this issue Nov 22, 2023 · 2 comments
Open

Support HTTPX cli #114

karpetrosyan opened this issue Nov 22, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@karpetrosyan
Copy link
Owner

karpetrosyan commented Nov 22, 2023

I think it would be great for us to support httpx cli, but with the HTTP caching layer.

We could have our own cli entry point, which is going to be hishel,
and we can just take the existing httpx cli and change the Client class to CacheClient, and that's it.

We should try to do this without sticking to the particular HTTPX version, so we can be sure that by adding this feature, we are not making the development process more complicated.
I guess for the start we could just mock the httpx module because httpx cli does not support client injecting.

Examples:

Instead of

httpx https://hishel.com --download hishel.html --proxies https://example.com --timeout 5

do

hishel https://hishel.com --download hishel.html --proxies https://example.com --timeout 5
@karpetrosyan karpetrosyan added the enhancement New feature or request label Nov 22, 2023
@T-256
Copy link

T-256 commented Nov 30, 2023

https://github.com/encode/httpx/blob/fd60b1815cf92354d097ac46aea63ebc0f34fd21/httpx/_main.py#L309-L447

Is there anyway to get these lines from httpx._main at runtime and decorate over our hishel client instead?

@karpetrosyan
Copy link
Owner Author

karpetrosyan commented Dec 1, 2023

You can just import the main function, decorate and then call it

Maybe we could also add storage and controller-related options, for example, to specify where the response should be stored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants