This demo is to illustrate how to install and leverage Function's API client using Python.
Make sure you have at least Python 3.7 installed.
First, create a virtualenv and activate it.
macOS and Linux
python -m venv venv
source venv/bin/activate
Windows
python -m venv venv
venv\Scripts\activate
Next, add the Buf registry to pull Function's typed API client:
macOS and Linux
printf "
[global]
extra-index-url = https://buf.build/gen/python
" > venv/pip.conf
Windows
Create a new file in your venv
directory named pip.conf
and add the following:
[global]
extra-index-url = https://buf.build/gen/python
Finally, install dependencies:
pip install -r requirements.txt
Copy the env.example
file to .env
and fill in your Function API key.
Once you have done that, you can run the demo:
python demo.py
See the demo.py file for the source code.