Skip to main content

Lighthouse API client

The client is tightly tied to the RESTful API RAML specification, which is very well exposed here.

Authentication

The Lighthouse API Client expects to find the following environment variables:

  • (required) OGLH_API_USER a valid Lighthouse user

  • (required) OGLH_API_PASS a valid Lighthouse user’s password

  • (required) OGLH_API_URL the Lighthouse API url without /api/v1

Conventions

All the methods follow the convention specified as follows. A call for an url like:

GET /system/global_enrollment_token HTTP/1.0

would be performed through the client as:

>>> from oglhclient import LighthouseApiClient
>>> api = LighthouseApiClient()
>>> client = api.get_client()
>>> client.system.global_enrollment_token.get()

Basically, all / must be replaced by . followed by an action:

GET: find()

Used when asking for a specific object

Example:

GET /nodes/smartgroups/myGrouId HTTP/1.0

Becomes:

smartgroup = client.nodes.smartgroups.find(id='myGrouId')

or

smartgroup = client.nodes.smartgroups.find('myGrouId')

In case of a child object like in /nodes/{id}/tags/{tag_value_id}, with a possible call like:

GET /nodes/nodes-13/tags/London HTTP/1.0

The python call should be:

tag = client.nodes.tags.find(id='myTagId', parent_id='myNodeId')

Also possible to make:

tag = client.nodes.tags.find(id='myTagId', node_id='myNodeId')

Always paying attention to the simple plural formatting removal:

  • nodes: node

  • properties: property

GET: list()

Used when asking for a list of objects

Example:

GET /nodes/smartgroups HTTP/1.0

Becomes:

smartgroups = client.nodes.smartgroups.list()

parameters may apply like page, per_page, and so on:

smartgroups = client.nodes.smartgroups.list(page=1,per_page=5)

GET: get()

Only used when the two previous do not apply, like:

GET /system/webui_session_timeout HTTP/1.0

Becomes:

timeout = client.system.webui_session_timeout.get()

POST: create()

As the name suggests, it is used to create objects, for instance:

POST /tags/node_tags HTTP/1.0
Content-Type: application/json

{"node_tag": {"name": "Location","values": [{"value": "USA.NewYork"},{"value": "UK.London"}]}}

could be performed as:

result = client.tags.node_tags.create(data={"username":"root","password":"default"})

PUT: update()

It is used to update a given object, like:

PUT /tags/node_tags/nodes_tags-1 HTTP/1.0
Content-Type: application/json

{"node_tag": {"name": "Location","values": [{"id": "tags_node_tags_values_90","value": "USA.NewYork"}]}}

could be performed as:

data = {
  "node_tag": {
    "name": "Location",
    "values": [
      {
        "id": "tags_node_tags_values_90",
        "value": "USA.NewYork"
      }
    ]
  }
}
result = client.tags.node_tags.update(tag_value_id='nodes_tags-1', data=data)

DELETE: delete()

It is used for deleting an object by its id, for instance:

DELETE /tags/node_tags/nodes_tags-1 HTTP/1.0

could be performed as:

result = client.tags.node_tags.delete(tag_value_id='nodes_tags-1')

Metadata

Release files for oglhclient 1.0.0

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

Source distribution (sdist)

Source distribution for oglhclient 1.0.0
File Size Uploaded
oglhclient-1.0.0.tar.gz 54.9 kB Details

Release files / oglhclient-1.0.0.tar.gz

Download URL oglhclient-1.0.0.tar.gz
Size 54.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8c24d01f011cc49355d20ad96f22f448e2761194aaf53969577d88631bc222e5
BLAKE2b-256 checksum
How to use checksums
85795b1fdfe5adf1f9813e626a97823f375e211429426cdf242536e3cf6ba604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
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