Python and Requests Package

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

is loading …

Next we will display the text and the image using the Text Viewer block and the Image Box block, respectively.

is loading …
is loading …

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.

is loading …

Next we will use a Text Viewer block to display the fetched text data.

is loading …

If we want to fetch a binary object we should use pyfetch.

is loading …

Next we will use an Image Box block to display the fetched binary object (a JPEG image).

is loading …

First Published

in

Last Updated

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *