I've been trying to get the basic example to work in Jupyterlite, just changing micropip to instead use the %pip magic:
%pipinstall-qpyodide-httprequestsimportpyodide_httppyodide_http.patch_all() # Patch all librariesimportrequestsresponse=requests.get('http://raw.githubusercontent.com/statsbomb/open-data/master/data/lineups/15946.json')
The cells run without errors, but the response object has a status code of 0, and response.content is empty. Am I missing something?
The result is the same running locally using jupyter lite serve, and on GitHub Pages.
That didn't seem to make any difference, but I had a look in the browser console and saw this:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/statsbomb/open-data/master/data/lineups/15946.json. (Reason: CORS request did not succeed). Status code: (null).
Failed to load ‘https://raw.githubusercontent.com/statsbomb/open-data/master/data/lineups/15946.json’. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with ‘TypeError: NetworkError when attempting to fetch resource.’.
What browser did you use? I'm getting a JsException: NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://github.com/mwaskom/seaborn-data'. error in Chrome on MacOS.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://github.com/mwaskom/seaborn-data. (Reason: CORS request did not succeed). Status code: (null
Activity
koenvo commented on Dec 14, 2022
Hmm there seems to be an issue with redirects. Can you try with https:// instead of http:// ?
wragge commented on Dec 14, 2022
That didn't seem to make any difference, but I had a look in the browser console and saw this:
jtpio commented on Jan 3, 2023
Also seeing something similar (status code 0) when trying out the following code snippet in jupyterlite/jupyterlite#940:
koenvo commented on Jan 3, 2023
Thanks for the report!
What browser did you use? I'm getting a JsException: NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://github.com/mwaskom/seaborn-data'. error in Chrome on MacOS.
jtpio commented on Jan 4, 2023
It was with Firefox 108 with the following error:
dazzag24 commented on Mar 30, 2023
Seeing the same here:
console output:

Firefox 111.0.1 (64-bit)
rth commented on Mar 30, 2023
This might be an issue with the Pyodide FFI pyodide/pyodide#1653 where the exception isn't passed properly
koenvo commented on Mar 30, 2023
Just installed Firefox and I do get the same error as you get. When I do a manual request using
it seems to work fine.
Maybe it's something with some headers requests is adding. Lets dig into this.
[edit1]
Got a failing minimal example

[edit2]
Hah! It's the 'User-Agent' header. Let me do some additional testing
[edit3]
It seems to be related to https://bugzilla.mozilla.org/show_bug.cgi?id=1629921
koenvo commented on Mar 30, 2023
I just released version 0.2.1 with a fix for this issue.
@wragge @dazzag24 can you also verify it works for you?
@jtpio your issue with seaborn is fixed when mwaskom/seaborn#3234 is released.
wragge commented on Apr 2, 2023
Confirming that my basic example now works. Thanks!
koenvo commented on Apr 2, 2023
Thanks for both reporting this bug and testing the fix!
dazzag24 commented on Apr 2, 2023
Works for me now:
Many thanks