A Python client library for managing WireGuard server users and sessions.
Project description
WGM - API Client for WireGuard Management
Overview
WGM is a Python client library designed to interact with a WireGuard server API. This library enables actions such as creating, deleting, enabling, and disabling users, as well as managing sessions and retrieving user information.
Features
- Session Management: Start a session with the server using provided credentials (IP, port, password).
- User Management: Retrieve a list of all users, and perform actions like create, delete, enable, and disable users.
- Session Re-establishment: Automatically re-establishes a session if authentication fails.
- HTTP Method Support: Supports
POST,DELETE,PUTHTTP methods for data manipulation.
Installation
To install dependencies, use Poetry. Just run the command:
poetry install
This will install all the dependencies specified in project.toml.
Using WGM
from WGM_api import WGM_api
# Session initialization #
session = WGM_api()
# Set up a session with the server #
session.start_session(ip_address="ip_address", port=port, password="your_password")
# Example of creating a new user #
session.create_user(name="user_name")
# Example of deleting a user #
session.delete_user(value="existing_user")
# When creating a user, we must specify the desired name, while when deleting a user, it can be done either by name or by ID. #
Methods
- start_session(ip_address, port, password) — Initializes a session with the server.
- get_all_users() — Retrieves a list of all users.
- create_user(name) — Creates a new user.
- delete_user(value) — Deletes a user (by name or ID).
- enable_user(value) — Enables the user (by name or ID).
- disable_user(value) — Disables the user. (by name or ID).
- download_config(value) — Download config file the user. (by name or ID).
PyPI
The WGM library is available on PyPI, making it easy to install and integrate into your projects.
Install it via pip:
pip install wgm_api
Or poetry:
poetry add wgm_api
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wgm_api-0.1.19.tar.gz.
File metadata
- Download URL: wgm_api-0.1.19.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e63c5d576b04fd4a3a2d3cf5be836a7a15e40313ddc90f3c1b5e9beb262b0fc9
|
|
| MD5 |
c9904d12f017c1d9fad2ded57789d11d
|
|
| BLAKE2b-256 |
a161ce9c74ba914e18bc99fccbe53af361b5d90674aa87e341c7a40b70c6c1ed
|
File details
Details for the file wgm_api-0.1.19-py3-none-any.whl.
File metadata
- Download URL: wgm_api-0.1.19-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c40e943d912dfd0cc51892523ed07381d431b9b5d8248da6f8d94695844fdb0e
|
|
| MD5 |
fc441af23c8a1931978bb9ff46de1939
|
|
| BLAKE2b-256 |
6c178740428e6afb0dd2f2fdfbb93d58d8359abd5a248deff0da3cee158abc17
|