Skip to content

Make HTTP requests from inside WASM in Extism PDK for Python . Devcontainer.

License

Notifications You must be signed in to change notification settings

wasm-outbound-http-examples/extism-python-pdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use Extism PDK for Python to send HTTP(s) requests from inside WASM

Open in GitHub Codespaces

Instructions for this devcontainer

Tested with Extism Python PDK commit 967e40d9, Extism CLI v1.5.4.

Preparation

  1. Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.

  2. Install extism-python-pdk and its dependencies like Binaryen's wasm-merge and wasm-opt by invoking the official installation script:

curl -sSL -O https://github.com/extism/python-pdk/raw/967e40d9355707b509a78090b150079ed08878bd/install.sh
sh install.sh

Building

  1. Compile the example by using just-installed extism-py binary:
extism-py httpget.py -o HTTPRequestingPlugin.wasm

Test with Extism CLI

For testing purposes, you can invoke functions from Extism plugins with Extism CLI.

  1. Install Extism CLI from Github releases:
wget https://github.com/extism/cli/releases/download/v1.5.4/extism-v1.5.4-linux-amd64.tar.gz -O /tmp/extism.tar.gz
tar -xzf /tmp/extism.tar.gz -C /tmp ; mv /tmp/extism .

And now you have extism binary in current folder.

  1. Run httpget function from extism plugin with CLI, allowing outbound connections to all hosts:
./extism call HTTPRequestingPlugin.wasm httpget --allow-host '*' --wasi

Finish

Perform your own experiments if desired.


Created for (wannabe-awesome) list

About

Make HTTP requests from inside WASM in Extism PDK for Python . Devcontainer.

Topics

Resources

License

Stars

Watchers

Forks

Languages