Skip to main content

Headscale API client

Project description

Headscale API client

This module is a client for Headscale API. It can manage all the entities of headscale, namely:

  • nodes
  • users
  • routes
  • preauthkeys
  • apikeys

Wherever it was possible I used python data types, for example datetime is used for all the dates, while int is used for all IDs;

Schemas

Using the OpenAPI specs provided by headscale, I converted them to python classes, so you can refer to the Headscale OpenAPI specification in file headscale.openapi.json for more details, but I will try to provide a list of classes and methods available.

Nodes

Methods:

  • list: list all the nodes registered on headscale;
  • get: retrieve a specific node by its ID
  • byUser: retrieve all the nodes of a user, given the username;
  • delete: deletes a node, by ID;
  • expire: expire (disconnect) a node, by ID;
  • rename: rename a node, by ID;
  • move: assing a nide to a new user;
  • routes: retrieve all the routes announced by a node;
  • setTags: set tags for a node;
  • backfillips: (currently broken in Headscale), fills the nodes table with all the IPs, to be used in rare cases;

Properties:

  • expired: if the node is expired;
  • expireDate: when the node is going to expire;

Users

Methods:

  • list: list all users'
  • get: get a user, by ID;
  • create: create a new user, given a username;
  • delete: delete a user, given the username;
  • rename: rename a user, given the current and the new username;

Routes

Methods:

  • list: get all routes;
  • delete: deletes a route, given the ID;
  • enable: enable a route, given the ID;
  • disable: disable a route given the ID;

API Keys

Methods:

  • list: list all the API keys;
  • create: create a new API key;
  • expire: invalidates a new API key;
  • delete: delete an API key;

PreAuth keys

Methods

  • list: list all the preauth keys for a user;
  • create: create a new preauth key for a user;
  • expire: expires (invalidates) a preauth key for a user;

Configuration

To be able to access headscale the module needs the URL of the headscale portal and an API key. These values are provided via environment variables, specifically:

  • HSAPI_SERVER
  • HSAPI_API_TOKEN

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

hsapi_client-0.9.6.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

hsapi_client-0.9.6-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file hsapi_client-0.9.6.tar.gz.

File metadata

  • Download URL: hsapi_client-0.9.6.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Darwin/23.6.0

File hashes

Hashes for hsapi_client-0.9.6.tar.gz
Algorithm Hash digest
SHA256 b6a4183fb9cdf95b0e864eec5b79ea18843e25379f928c4770b68e4f1ce8334b
MD5 dce0c49fd84a165338abff9eba87f9da
BLAKE2b-256 8cf2df3cac45c8aef77c6c7ac34aabce2d8f3da5dfe20a9b6e9f90a039a97a86

See more details on using hashes here.

File details

Details for the file hsapi_client-0.9.6-py3-none-any.whl.

File metadata

  • Download URL: hsapi_client-0.9.6-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Darwin/23.6.0

File hashes

Hashes for hsapi_client-0.9.6-py3-none-any.whl
Algorithm Hash digest
SHA256 441cd219a2384f66511b8cca21224171b4e6753d16d364d984eb9887aa686a6c
MD5 4c6bd411775518ecb37a27a742c6b361
BLAKE2b-256 a8acd44c5183177ce8e2d26d6097c6b8de49e145956dbdc3166e46f463f6075b

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