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

httpx support #37

Open
0xMochan opened this issue Jul 11, 2023 · 4 comments
Open

httpx support #37

0xMochan opened this issue Jul 11, 2023 · 4 comments

Comments

@0xMochan
Copy link

Leaving this issue here to think about httpx support. I hope to come back to this one day and take a crack at it. I think it should be relatively simple since httpx is written in a sans-io manner which theoretically means a fetch version would be relatively simple to accomplish.

@psymbio
Copy link

psymbio commented Nov 23, 2023

So, to fix this issue pyodide/pyodide#4292 I'm currently trying to work on this: https://github.com/psymbio/pyodide-http and (some reference notes https://github.com/psymbio/httpx_adapter)

Check this file: https://github.com/psymbio/pyodide-http/blob/main/pyodide_http/_httpx.py

There's an issue I am stuck at: Pyodide's Request class has a timeout attribute but the httpx Request class doesn't. Can you look into the code.

@psymbio
Copy link

psymbio commented Nov 28, 2023

@koenvo Can you have a look at this - https://github.com/psymbio/pyodide-http/tree/main/pyodide_http

Also, I'm not sure whether it's correct - any guidance will be helpful.

@psymbio
Copy link

psymbio commented Dec 10, 2023

This is solved by using a custom transport layer and urllib3/urllib3#3195. For the solution visit: encode/httpx#2994 (comment).

@CNSeniorious000
Copy link

CNSeniorious000 commented Aug 11, 2024

Here is an implementation that uses run_sync to syncify pyfetch. It don't support sync APIs if the js environment doesn't support JSPI. (Note that it is very easy for a website to support JSPI through origin trial)

  👉 A Live Demo

I wonder do you guys already did some work on using a custom layer to stream response in the sync API? I think psymbio/pyodide-http is almost there.

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

No branches or pull requests

3 participants