Python Guide

Python Module

Python Package Index module
Python3 interface to the NetFoundry API
pip install --upgrade --user netfoundry
# or
python3 -m pip install --upgrade --user netfoundry

Virtualenv

Alternatively, you could install the module in a project directory with virtualenv.

mkdir -p netfoundry-project && cd netfoundry-project
python3 -m pip install --user virtualenv
virtualenv venv
source venv/bin/activate
pip install netfoundry

Documentation

The module works with pydoc in the usual ways. For example:

pydoc netfoundry.Organization
pydoc netfoundry.NetworkGroup
pydoc netfoundry.Network
pydoc netfoundry.demo
pydoc netfoundry

Create a Custom Docker Container with the NetFoundry Python Module

Suppose you have written a Python program named “my-netfoundry-network.py” that imports the NetFoundry module. You could run your program with a Docker container image that has the NetFoundry module pre-installed.

FROM netfoundry/python
COPY ./my-netfoundry-network.py .
CMD ./my-netfoundry-network.py