Provides python methods to call the pfsense API endpoint provided by the package at https://github.com/jaredhendrickson13/pfsense-api
Configure it one of two ways
- Pass the
config_filename
which is a JSON file with username/password/host (and optionally port). - Directly pass username/password/hostname (and optionally port).
At the moment it only supports the "Local Database" authentication method of username/password, but it should be relatively trivial to add JWT/API Token support at a later time.
(If you're going to do this, modify init to have a "mode" setting, which call()
checks, then modifies things as needed.)
{
"username" : "me",
"password" : "mysupersecretpassword",
"hostname" : "example.com",
"port" : 8443
}
You can specify a requests_session
option on construction, which one could configure to ignore verification.
import requests
from pfsense_api_client import PFSenseAPIClient
session = requests.Session()
session.verify = False
api = PFSenseAPIClient(
config_filename="~/.config/pfsense.json",
requests_session=session,
)