Skip to main content

python-glpi-utils

Tests PyPI version Python versions License: AGPL v3

Python client for GLPI that handles both of its APIs for you: the legacy REST API and the OAuth2 High-Level API, sync or async, with pagination and token refresh built in.

You write api.ticket.get_all_pages() instead of managing session tokens, Content-Range headers, OAuth2 expiry and the different URL layout of each API. Licensed under the AGPL-3.0-or-later since 2.0.0 (1.5.0 and earlier remain MIT). Python 3.9+, depends on requests (plus aiohttp for the async clients).

pip install glpi-utils      # imported as glpi_utils
from glpi_utils import GlpiAPI

with GlpiAPI(url="https://glpi.example.com") as api:      # logs out on exit
    api.login(username="glpi", password="glpi")
    print(api.version)                                     # GLPI server version: 12.0.0

    ticket = api.ticket.create({"name": "srv-db01 unreachable", "content": "ICMP loss 100%"})
    api.ticket.add_sub_item(ticket["id"], "ITILFollowup", {"content": "On-call notified"})

    for t in api.ticket.get_all_pages():                   # every page, fetched for you
        print(t["id"], t["name"])                          # one line per ticket, e.g. 7 srv-db01 unreachable

Why this one

The most used alternative on PyPI is glpi-api. Choose by what you need:

python-glpi-utils glpi-api
Legacy REST API (/apirest.php) yes yes
High-Level API with OAuth2 (/api.php, GLPI 11 and 12) yes, with API version pinning no
Async client (aiohttp) yes no
Fetch every page in one call get_all_pages() / iter_pages() no
Legacy search engine by field name (mapped to numeric search-option IDs) no, pass the IDs yes (field_id, list_search_options)
get_multiple_items, download_document no yes
License AGPL-3.0-or-later GPL-3.0

If you only call the legacy API synchronously and want to search it by field names, glpi-api is the more established choice. Use this library for async code or for the High-Level API of GLPI 11 and 12. Both libraries work with the legacy API on GLPI 12.

Install

pip install glpi-utils             # GlpiAPI, GlpiOAuthClient
pip install "glpi-utils[async]"    # adds AsyncGlpiAPI, AsyncGlpiOAuthClient

On the GLPI side, enable the API in Setup → General → API. For the legacy API, pass app_token= only if your GLPI API client defines one. For the High-Level API, add an OAuth client in Setup → OAuth clients with the Password grant and the api scope.

Clients

Sync / async GLPI API Auth GLPI versions
GlpiAPI / AsyncGlpiAPI legacy /apirest.php username + password, or personal user_token 9.1 and later
GlpiOAuthClient / AsyncGlpiOAuthClient High-Level /api.php OAuth2 password grant, token refreshed automatically 11.0.6 and later, 12
from glpi_utils.oauth import GlpiOAuthClient

with GlpiOAuthClient(url="https://glpi.example.com", client_id="...", client_secret="...",
                     username="svc-api", password="...", api_version="2.3") as api:
    api.authenticate()
    api.search("Ticket", filter="status.id==1;name=like=*srv*", limit=20)

Pin api_version on the OAuth2 clients. If you leave it out, the server picks its newest High-Level API version: 2.3 on GLPI 11, 3.0 on GLPI 12. The two return different schemas. Pinning "2.3" keeps code written for GLPI 11 working on 12 (12.0.0 only adds a few fields to 2.3 and drops the Plug dropdowns); you miss the endpoints added in 3.0, such as login-session management. filter takes RSQL expressions over field names. See the OAuth2 guide for the differences.

All clients share the same accessors (api.ticket, api.computer, api.user, … or api.item("AnyItemtype")), CRUD methods, sub-items, typed exceptions (GlpiAuthError, GlpiNotFoundError, GlpiPermissionError…) and debug logging with passwords and tokens masked. Settings can come from environment variables (GLPI_URL, GLPI_USER, GLPI_USER_TOKEN, GLPI_OAUTH_CLIENT_ID, GLPI_API_VERSION…).

Documentation

Guides and API reference: https://giovanny07.github.io/python-glpi-utils/

Status

Beta, actively maintained. Releases follow semantic versioning and every change is listed in the CHANGELOG. The legacy clients are the most stable part. The OAuth2 clients follow GLPI's High-Level API, which is still evolving, and their behaviour changed in 1.4 and 1.5.

Tested in CI on Python 3.9 to 3.13 with mocked HTTP. Tested by hand against real servers for 1.5.0 (2026-10-13): GLPI 10.0.28 (legacy API), 11.0.9 and 12.0.0 (legacy API, High-Level API 2.3 and 3.0). Older GLPI 9.x and 10.x releases are expected to work with the legacy clients but are not tested.

Contributing

Bug reports with your GLPI version and a traceback are the most useful contribution: open an issue. For code, see the contributing guide.

License

Copyright (C) 2025-2026 Giovanny Rodriguez, Imagunet.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed WITHOUT ANY WARRANTY; see the license for details.

Releases up to and including 1.5.0 were published under the MIT License and remain available under it.

Metadata

Release files for glpi-utils 2.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 glpi-utils 2.0.0
File Size Uploaded
glpi_utils-2.0.0.tar.gz 58.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glpi-utils 2.0.0
File Interpreter ABI Platform
glpi_utils-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 102.1 kB

Release files / glpi_utils-2.0.0.tar.gz

Download URL glpi_utils-2.0.0.tar.gz
Size 58.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bf51c30019dea32518a14489be801bb112e2783ccb6dd86e6714e993b015c775
BLAKE2b-256 checksum
How to use checksums
087c17480827808e718daeab14a378f0bdf1ecd8194f310b30bbbbce0f4af627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / glpi_utils-2.0.0-py3-none-any.whl

Download URL glpi_utils-2.0.0-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13b0d200253088e692293eaf422a1d44f3af32d558845b4e90afa8b85ff61a51
BLAKE2b-256 checksum
How to use checksums
2b73742f8d96cd9bcf10daac83eb6d43ce2fbb353f2e8a7fe221e503f11ba5d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release history Release notifications | RSS feed

2.0.1

2 release files

This release

2.0.0 This release

2 release files

1.5.0

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.9

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.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