Python and Requests Package

Our Python code block relies on Pyodide, a Python distribution that does not support the requests package.

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 PNG image).

is loading …

First Published

in

Last Updated

Comments

Leave a Reply

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