pyodide: open_url not working?
I am starting a Firefox browser (version 100.0.2) on Ubuntu linux 22.04, using a new profile/
Navigating to https://pyodide.org/en/stable/console.html showing banner:
Welcome to the Pyodide terminal emulator š
Python 3.10.2 (main, Apr 9 2022 20:52:01) on WebAssembly VM
Type "help", "copyright", "credits" or "license" for more information.
In the console I run and get an unexpected exception:
>>> import pyodide
>>> pyodide.http.open_url("https://www.w3.org/Protocols/HTTP/")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/lib/python3.10/site-packages/pyodide/http.py", line 41, in open_url
req.send(None)
JsException: NetworkError: A network error occurred.
Another attempt:
>>> url = "https://www.ofai.at/about"
>>> with open_url(url) as infp:
... text = infp.read()
...
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/lib/python3.10/site-packages/pyodide/http.py", line 41, in open_url
req.send(None)
File "https://pyodide.org/en/stable/console.html", line 1, in XMLHttpRequest.prototype.send<
JsException: NetworkError: A network error occurred.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
Oh it seems like
crossorigin.meservice is currently dead⦠Probably you should find some other services or run your own proxy server.Well I think this is not true.
originheader is automatically set by the browser and the user cannot modify it.One possible option is to use the CORS proxy server (e.g. https://corsproxy.github.io/).
Iām surprised you are getting so many of these errors. If I go to
localhost:8000/console.htmland useopen_url("http://localhost:8000/console.html")it works fineā¦As an afterthought, it may be useful to add information about this limitation to the FAQ and/or the
open_urldocstring to make it easier for people like me to not consider this a bug? šFor your testing purposes you can run Chrome without CORS with
--disable-web-security(more in mdns link from @rth). I tested your link https://www.ofai.at/about withpyodide.open_urland it works.