Package: pritunl-api
Pritunl API Client for PythonThis is a simplePritunlAPI Client written in Python.You need to refer to PritunlAPI Documentationto understand how to use this. This API client uses almost the same command as theAPI Handlers.InstallationInstall the published package usingpipfrom ourPyPI project repository.pipinstallpritunl-apiBeyond the core API client library, we also added the executable distribution in this project. Add extracliduring the PIP installation to enable the CLI feature.pipinstallpritunl-api[cli]Proceed to theCLI Usagefor the complete command options and syntax.API UsageBefore using the API library including the use of the CLI feature, we need to provide the Pritunl API URL and administrative credentials in our environment variables.exportPRITUNL_BASE_URL="https://vpn.domain.tld/"exportPRITUNL_API_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"exportPRITUNL_API_SECRET="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"Initializing an API Instance.# Import the objectfrompritunl_apiimportPritunl# Create an instancepritunl=Pritunl()## You can also initialize an instance by manually providing the arguments.# pritunl = Pritunl(#   url="<PRITUNL API URL>",#   token="<PRITUNL API TOKEN>",#   secret="<PRITUNL API SECRET>"# )# Your Pritunl API Client instance is now ready to use!pritunl.<FEATURE>.<METHOD>ExampleExample 1:(in source)GET /serverpritunl.server.get()Example 2:(in source)PUT /server/:server_id/organization/:organization_idpritunl.server.put(srv_id='',org_id='')Example 3:(in source)DELETE /user/:organization_id/:user_idpritunl.user.delete(org_id='',usr_id='')Example 4:(in source)POST /server**pritunl.server.post(data={'name':'new server name'})If there is data available, you must pass it through the data parameter.The command above works well because there are templates available for creating a new server.Example 5:(in source)PUT /user/:organization_id/:user_idpritunl.user.put(org_id='',usr_id='',data={'name':'modified org name','disabled':True})CLI UsageAvailable CommandsAs of this period of development, the feature is limited.To show the available commands, use the help option.pritunl-api-cli--helpUsage: pritunl-api-cli [OPTIONS] COMMAND [ARGS]...

  Pritunl API CLI

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  api
  userTo show the available commands for a featurepritunl-api-cliuser--helpUsage: pritunl-api-cli user [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  create
  delete
  get
  updateFor available command options and syntax, use the feature command argument help option.pritunl-api-cliusercreate--helpUsage: pritunl-api-cli user create [OPTIONS]

Options:
  --org-name TEXT
  --user-name TEXT
  --user-email TEXT
  --pin TEXT
  --yubikey-id TEXT
  --from-csv PATH
  --help             Show this message and exit.Example 1: Create a Single Userpritunl-api-cliusercreate\--org-namepritunl-dev\--user-namejohn.doe\--user-emailjohn.doe@domain.tldExample 2: Create Users from CSVpritunl-api-cliusercreate\--from-csv./users.csvFor more CLI examples checkout the blog postManaging Enterprise VPN using Pritunl API CLI.API DevelopmentUsing Virtual EnvironmentCreate a virtual environment and activate it.python-mvenv./venvsource./venv/bin/activateOr simple use other Python Version Manager likepyenv.pipinstall-e.Include REPL Toolspipinstall-e.[repl]ptipythonUsing Docker EnvironmentBuilding a Development Containerdockerbuildxbuild.\--progressplain\--filedev.Dockerfile\--tagpritunl-api:developmentRunning a Development Containerdockerrun--rm-it\--volume$(PWD):/pritunl-api\--env-file.env\pritunl-api:developmentThis API client is not fully complete. Some features are missing, feel free to fork and pull requests to add new features.Tested working onPritunl v1.30.3354.99.