Our Python code block relies on Pyodide, a Python distribution that used to not support the requests
package (inseri core < 0.3.5). But now we can easily use the requests
package. If you use an older older version please go to For inseri core < 0.3.5
Next we will display the text and the image using the Text Viewer block and the Image Box block, respectively.
For inseri core < 0.3.5
Click to expand
inseri core 0.3.5 comes with Pyodide 0.25 where requests package was added. For previous versions please read below
However, the built-in pyodide.http
module provides two functions that can be used for network requests.
If we need to fetch some text data we should use open_url
.
Next we will use a Text Viewer block to display the fetched text data.
If we want to fetch a binary object we should use pyfetch
.
Next we will use an Image Box block to display the fetched binary object (a JPEG image).
Leave a Reply