Use pyodide_http.patch_all() instead of patch_urllib() #4488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HTTP requests done from a Marimo WASM notebook are not carrying any cookies that the browser may have stored. This breaks requests to URLs that use cookie-based authentication (e.g. where the user authenticates in another browser tab/window, like URLs protected by Cloudflare Access).
The underlying issue is the lack of the proper credential flags for
XMLHttpRequest
inpyodide-http
andurllib3
, and I've opened pull-requests for both of those projects:However, Marimo is only patching network calls for the standard library's
urllib
, and it should be patching all calls thatpyodide-http
knows about. If so, then only thepyodide-http
change is necessary to have HTTP requests from Marimo start carrying (implicit) cookies.See "cookies in wasm" thread on Discord: https://discord.com/channels/1059888774789730424/1358809549187977518