A typed Python client for GLPI ITSM APIs.
Project description
glpi-python-client
glpi-python-client is a typed Python client for GLPI ITSM APIs.
The goal is to let GLPI integrations work with domain objects instead of raw JSON payloads. The package exposes Pydantic models for tickets, users, followups, documents, locations, and related records, while converting GLPI HTML content into Markdown for Python-side workflows and rendering Markdown back to HTML for outgoing payloads.
It currently focuses on ticket-centric workflows and exposes a single asynchronous high-level client built on top of the GLPI v2 REST API.
While the package is preparing for 1.0, alot of potential breaking change might happen between versions. A deprecation policy will be put in place once 1.0 is out and the package have been stabilized.
Installation
pip install glpi-python-client
For local development:
python -m pip install -e .[dev]
python -m pytest
Quick Start
Create a client with your GLPI v2 API URL and at least one complete auth pair:
client_idandclient_secretusernameandpassword- both pairs together
import asyncio
from glpi_python_client import GlpiClient, PostTicket
async def main() -> None:
async with GlpiClient(
glpi_api_url="https://glpi.example.com/api.php/v2",
client_id="oauth-client-id",
client_secret="oauth-client-secret",
username="api-user",
password="api-password",
) as glpi:
ticket_id = await glpi.create_ticket(
PostTicket(
name="Printer issue",
content="The printer is not reachable from the office network.",
)
)
ticket = await glpi.get_ticket(ticket_id)
print(ticket.id, ticket.name)
asyncio.run(main())
If your application already provides GLPI_ environment variables,
GlpiClient.from_env() is also available.
Calling from synchronous code
The client is async-only, but it works from sync programs through
asyncio.run. Wrap the calls in a coroutine and execute it once:
import asyncio
from glpi_python_client import GlpiClient
def fetch_open_tickets() -> list[int]:
async def _run() -> list[int]:
async with GlpiClient.from_env() as glpi:
tickets = await glpi.search_tickets("status==1", limit=10)
return [ticket.id for ticket in tickets]
return asyncio.run(_run())
if __name__ == "__main__":
print(fetch_open_tickets())
For long-lived sync services that need many calls, run a dedicated
event loop on a background thread and dispatch with
asyncio.run_coroutine_threadsafe. See the
user guide
for the full pattern.
Documentation
To build the Sphinx documentation locally:
python -m pip install -e .[docs]
python -m sphinx -b html docs docs/_build/html
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
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 glpi_python_client-0.2.1.tar.gz.
File metadata
- Download URL: glpi_python_client-0.2.1.tar.gz
- Upload date:
- Size: 221.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea7aff5da186fd24bfd28562172001835ba0099b0203aae330351ef47b07337c
|
|
| MD5 |
d9e548f8dd25e01d957ae493120174d4
|
|
| BLAKE2b-256 |
69ec58919e2231b8425226a0f8650c929430a67e8d15a324e33c9617cc54e973
|
Provenance
The following attestation bundles were made for glpi_python_client-0.2.1.tar.gz:
Publisher:
release.yml on baraline/glpi_python_client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glpi_python_client-0.2.1.tar.gz -
Subject digest:
ea7aff5da186fd24bfd28562172001835ba0099b0203aae330351ef47b07337c - Sigstore transparency entry: 1553269602
- Sigstore integration time:
-
Permalink:
baraline/glpi_python_client@2a177e1b23598066c94a689f541989c095571a4e -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/baraline
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2a177e1b23598066c94a689f541989c095571a4e -
Trigger Event:
release
-
Statement type:
File details
Details for the file glpi_python_client-0.2.1-py3-none-any.whl.
File metadata
- Download URL: glpi_python_client-0.2.1-py3-none-any.whl
- Upload date:
- Size: 112.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
165b5c1ac6a7e7f6c7a8c0c5a233503bd27397e5a1e29c54fd19c1ef06ae1317
|
|
| MD5 |
c373b66cfe103f7a90f42d54f43db860
|
|
| BLAKE2b-256 |
e0fa9e9ceeb322bbc51a0fefc7366d6db5d27f28830f12cadbd0568305487253
|
Provenance
The following attestation bundles were made for glpi_python_client-0.2.1-py3-none-any.whl:
Publisher:
release.yml on baraline/glpi_python_client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glpi_python_client-0.2.1-py3-none-any.whl -
Subject digest:
165b5c1ac6a7e7f6c7a8c0c5a233503bd27397e5a1e29c54fd19c1ef06ae1317 - Sigstore transparency entry: 1553269792
- Sigstore integration time:
-
Permalink:
baraline/glpi_python_client@2a177e1b23598066c94a689f541989c095571a4e -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/baraline
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2a177e1b23598066c94a689f541989c095571a4e -
Trigger Event:
release
-
Statement type: