For longest time I’d been meaning to roll a PyPi package for the Python client interface to FauxAPI, and it is now a thing - it also closes the long open issue #22 asking about PyPi from way back.


PyPi Build Status

Install it using pip:-

  pip install pfsense-fauxapi

Github project

Command Line

Additionally this pip-package provides a command-line interface to work with FauxAPI

usage: fauxapi [-h] [--host [host]] [--apikey [key]] [--apisecret [secret]]
               [--verified-ssl] [--debug]
               [function] [[function] ...] [[function-args]]


optional arguments:
  -h, --help            show this help message and exit

  --host [host]         Host address of the target pfSense host with the
                        PfsenseFauxapi package installed.
  --apikey [key]        FauxAPI apikey value - alternatively via the
                        FAUXAPI_APIKEY environment variable.
  --apisecret [secret]  FauxAPI apisecret value - alternatively via the
                        FAUXAPI_APIKEY environment variable.
  --verified-ssl        Enable SSL certificate checks - default does NOT check
                        SSL certificates.
  --debug               Enable debug response from the remote FauxAPI -
                        helpful in tracking down issues.
  [function]            The FauxAPI function being called
  [function-args]       Arguments to the function, space separated

Command line example, using environment variables to pass the FAUXAPI_APIKEY and FAUXAPI_APIKEY credentials.

$ fauxapi --host gateway_status | jq .
  "callid": "5c8d0f7361cba",
  "action": "gateway_status",
  "message": "ok",
  "data": {
    "gateway_status": {
      "": {
        "monitorip": "",
        "srcip": "",
        "name": "WAN_DHCP",
        "delay": "0.422ms",
        "stddev": "0.073ms",
        "loss": "0.0%",
        "status": "none"

Package Testing

Tests for (almost) all client-side function calls are implemented with mocked API response data you can check them with pytest

  python test

Packages are tested via Travis

Package Build

Should you need/want to build the package from source

# obtain the source material
git clone
cd pfsense_fauxapi_client_python

# build the package
python sdist bdist_wheel

# install the package from the .whl file in the dist path 
pip install dist/pfsense*.whl