Skip to main content

Pritunl API client for Python 3

This is a simple api client written in Python 3. View example in example.py. Python 2 is not supported. You need to refer Pritunl api doc to get the idea on how to use this.

Basically this api client use almost same command like in the doc. For example:

Quick Usage

import os

from pritunl_api import Pritunl

PRITUNL_BASE_URL = os.environ.get('PRITUNL_BASE_URL')
PRITUNL_API_TOKEN = os.environ.get('PRITUNL_API_TOKEN')
PRITUNL_API_SECRET= os.environ.get('PRITUNL_API_SECRET')

pritunl = Pritunl(
    url=PRITUNL_BASE_URL,
    token=PRITUNL_API_TOKEN,
    secret=PRITUNL_API_SECRET
    )

Example

  • Example 1:

    (in source) GET /server

    pritunl.server.get()
    
  • Example 2:

    (in source) PUT /server/:server_id/organization/:organization_id

    pritunl.server.put(srv_id='', org_id='')
    
  • Example 3:

    (in source) DELETE /user/:organization_id/:user_id

    pritunl.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 data parameter.

    * Command above works well because there are template available for creating a new server.

  • Example 5:

    (in source) PUT /user/:organization_id/:user_id

    api.user.put(org_id='', usr_id='', data={
      'name': 'modified org name',
      'disabled': True})
    

Installation

pip install pritunl-api

Include REPL Tools

pip install pritunl-api[repl]

API Development

Docker Environment

Building a Development Container

docker buildx build . \
  --progress plain \
  --file dev.Dockerfile \
  --tag pritunl-api:development

Running a Development Container

docker run --rm -it \
  --volume $(PWD):/pritunl-api \
  --env-file .env \
  pritunl-api:development

This api client is not fully complete. There are some features missing, feel free to fork and pull request to add new features.

Tested working on Pritunl v1.30.3354.99.

Metadata

Release files for pritunl-api 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pritunl-api 1.0.5
File Size Uploaded Provenance
pritunl-api-1.0.5.tar.gz 4.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pritunl-api 1.0.5
File Interpreter ABI Platform
pritunl_api-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / pritunl-api-1.0.5.tar.gz

Download URL pritunl-api-1.0.5.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e2dc394433734f299dac9246b906faffddd321431b95422452abe8c47186c894
BLAKE2b-256 checksum
How to use checksums
51f0aee77861a2d1516e369c9d796b9b82de943ac99d8430023d8158caeeda11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / pritunl_api-1.0.5-py3-none-any.whl

Download URL pritunl_api-1.0.5-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bf97fa5dc1aa24af70602890d9e2bf448126f3f65ff9c15eac3b2cfaad9d08e
BLAKE2b-256 checksum
How to use checksums
45dd4de3bbead280ec74c9abe9e2c4223a27e903616e40fcbdcc02fb4aa9d4c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Security for pritunl-api 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page