Skip to main content

glpi-python-client

CI Coverage License Python Docs

glpi-python-client is a typed Python client for the GLPI REST API.

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. On a response model that conversion is lazy — .content converts on first read and caches, so listing records costs nothing per body — and it degrades to plain text rather than failing on pathologically nested HTML. See Rich-text content.

It currently focuses on ticket-centric workflows and exposes two high-level clients built on top of the GLPI v2 REST API:

  • GlpiClient — synchronous, blocking client.
  • AsyncGlpiClient — asynchronous client doing real non-blocking I/O on the event loop.

Neither wraps the other. The async tree is hand-written and the sync one is generated from it, so the two surfaces cannot drift apart.

Note that all integration tests using this package are made on GLPI 11. I cannot make any guarantee of the behaviour on previous versions.

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_id and client_secret
  • username and password
  • both pairs together

Synchronous client

from glpi_python_client import GlpiClient, PostTicket

with GlpiClient(
    glpi_api_url="https://glpi.example.com/api.php/v2",
    server_timezone="Europe/Paris",
    client_id="oauth-client-id",
    client_secret="oauth-client-secret",
    username="api-user",
    password="api-password",
) as glpi:
    ticket_id = glpi.create_ticket(
        PostTicket(
            name="Printer issue",
            content="The printer is not reachable from the office network.",
        )
    )
    ticket = glpi.get_ticket(ticket_id)
    print(ticket.id, ticket.name)

Asynchronous client

import asyncio

from glpi_python_client import AsyncGlpiClient, PostTicket


async def main() -> None:
    async with AsyncGlpiClient(
        glpi_api_url="https://glpi.example.com/api.php/v2",
        server_timezone="Europe/Paris",
        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())

GlpiClient.from_env() and AsyncGlpiClient.from_env() are also available when the credentials are already exposed as GLPI_-prefixed environment variables.

Sync or async?

Both clients expose the exact same endpoint surface and accept the same constructor arguments, because both are generated from one source: the async tree is hand-written and the sync one is produced from it by a build step that strips async/await. AsyncGlpiClient performs real non-blocking I/O on the event loop — there is no worker thread and no executor — and GlpiClient performs real blocking I/O with no coroutine scheduling. An auth lock serialises OAuth token acquisition on both surfaces, so concurrent fan-outs cannot race.

Pick GlpiClient for plain scripts, CLI tools, and synchronous services; pick AsyncGlpiClient when your application already runs an event loop or when you need concurrent fan-out (the aggregated get_ticket_context and per-ticket get_task_statistics helpers overlap their calls there, and run them one after another on the sync client).

Documentation

To build the Sphinx documentation locally:

python -m pip install -e .[docs]
python -m sphinx -b html docs docs/_build/html

Sponsoring & Professional services

The development of this package is indirectly supported by Novahé & Constellation.

If you need professional help or services around GLPI, we offer consulting and engineering services to install, maintain or upgarde GLPI instance, as an official GLPI partner.

Metadata

Release files for glpi-python-client 0.6.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 glpi-python-client 0.6.0
File Size Uploaded
glpi_python_client-0.6.0.tar.gz 267.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glpi-python-client 0.6.0
File Interpreter ABI Platform
glpi_python_client-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 548.6 kB

Release files / glpi_python_client-0.6.0.tar.gz

Download URL glpi_python_client-0.6.0.tar.gz
Size 267.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aca15b0c07fb75bb37b7cd5caa9ec8ad539dc4a1a6ea41bb70a290e97f7e1016
BLAKE2b-256 checksum
How to use checksums
1398ff2e5bad080f8208300a1640f852863792506674a92bad4bddf004f92447
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / glpi_python_client-0.6.0-py3-none-any.whl

Download URL glpi_python_client-0.6.0-py3-none-any.whl
Size 281.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f1a18211297f110c5423563b766d0ae01f4def4bcc678e772d2a2dd98d1afc8
BLAKE2b-256 checksum
How to use checksums
4bf49665b70674e05c602f245ab3bc5dd9cb1160db6be5726d74f936715a79b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.1

2 release files

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.0

2 release files

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