marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.31k stars 155 forks source link

Patched urllib does not seem to work outside of Pandas #1681

Closed mrchrisadams closed 4 days ago

mrchrisadams commented 4 days ago

Describe the bug

Urllib does not seem to be patched when making network requests outside of Pandas in a WASM notebook.

I can see this was investigated in #934 (improvement: patch urllib in bootstrap to support networking) for WASM notebooks, and I can see Pandas working in a sample notebook fine. However using urllib directly does not seem to work as expected.

Environment

I am using the WASM version of Marimo, on the Marimo platform.

Code to reproduce

I've created a notebook demonstrating the behaviour below - with Pandas making network requests successfully, but urllib failing.

https://marimo.io/p/@mrchrisadams/making-network-requests

mrchrisadams commented 4 days ago

I think I've seen the issue now - it seems to be related to CORS support on the server you are trying to make a network request to.

mscolnick commented 4 days ago

Correct, this is a CORs issue. But it is on the destination server, not the origin server.

We provide an undocumented corsproxy if you'd like to use - https://corsproxy.marimo.app/<url>

Otherwise you will need to change the server's headers (assuming you own it).

mscolnick commented 4 days ago

Going to close this - let me know if you have any other questions/issues