Pritunl API Client for Python
Project description
Pritunl API Client for Python 3
This is a simple API Client written in Python 3.
You need to refer Pritunl API Documentationl to get an idea of how to use this. This API client uses almost the same command as in the API Handlers.
Installation
Install from our PyPI Project Repository
pip install pritunl-api
API Usage
import os
from pritunl_api import Pritunl
pritunl = Pritunl(
url=os.environ.get('PRITUNL_BASE_URL'),
token=os.environ.get('PRITUNL_API_TOKEN'),
secret=os.environ.get('PRITUNL_API_SECRET')
)
# Your Pritunl API Client Object is now ready to use!
pritunl.<FEATURE>.<METHOD>
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 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_id
api.user.put(org_id='', usr_id='', data={ 'name': 'modified org name', 'disabled': True})
API Development
Using Virtual Environment
pip install -e .
Include REPL Tools
pip install -e .[repl]
ptipython
Using 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 poetry shell
This API client is not fully complete. There are some features missing, feel free to fork and pull requests to add new features.
Tested working on Pritunl v1.30.3354.99
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pritunl_api-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaffcfb0210fc84848c159e48bb1cb0dc020ce7f0afcf31b5b6a847a2305f8ab |
|
MD5 | 91bbaa150839d351036a40cc57dad91e |
|
BLAKE2b-256 | 1c546e9d66416763cb18e1b1205bba70f2d0d0c443c14cc0fc9ba191d4cb2b39 |