Skip to main content

API wrapper for wg-easy

Project description

wg-easy-api

API wrapper for wg-easy

Installation

pip install wg-easy-api

Usage

from wg_easy_api import WgEasy

wg = WgEasy("http://wg-easy.sample.com:8080", "password")

async def main():
    clients = await wg.get_clients() # Get all clients
    client = await wg.get_client(clients[0].id) # Get client by id

    await wg.create_client("demo_client") # Create client 
    await wg.rename_client(client.id, "new_demo_client") # Rename client
    await wg.change_client_address(client.id, "10.20.30.40") # Change client address

    await wg.disable_client(client.id) # Disable client
    await wg.enable_client(client.id) # Enable client

    with open("client.conf", "w") as f:
        await f.write(await wg.get_client_config(client.id)) # Get client configuration

    with open("qrcode.svg", "wb") as f:
        await f.write(await wg.get_client_qrcode(client.id)) # Get client QR code
    
    await wg.delete_client(client.id) # Delete client


if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wg_easy_api-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

wg_easy_api-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file wg_easy_api-0.1.1.tar.gz.

File metadata

  • Download URL: wg_easy_api-0.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for wg_easy_api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 76d1329ccaefbe27a897dee8b949625da2ead980ea5ef013e6245ebcbf8ed487
MD5 f43784ecad1269a00eb35fb69719878c
BLAKE2b-256 ddf1516e62f22c5300189de46c22086ba1ecadff377c12dcb72ab8df933c0ff1

See more details on using hashes here.

File details

Details for the file wg_easy_api-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wg_easy_api-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for wg_easy_api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f28af6a695af9b879c831288ba59c5aa3a2d44dea872be3da7b93d33c09ea70
MD5 16cd374bae87d546781cbb2460c5afc1
BLAKE2b-256 464b4a47e180dc313dfb372767b7ba717f8a813c4bc98710570d6b1364a5293f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page