glpi-python-client 0.6.10__tar.gz → 0.6.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/CHANGELOG.md +65 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/PKG-INFO +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/api_reference.rst +23 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/user_guide.rst +127 -14
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/__init__.py +7 -1
- glpi_python_client-0.6.12/glpi_python_client/_async/_retry.py +90 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/auth/_v1_session.py +70 -28
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/auth/auth.py +41 -18
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/_base_client.py +24 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/__init__.py +2 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/__init__.py +4 -1
- glpi_python_client-0.6.12/glpi_python_client/_async/clients/api/assistance/_pending_reason.py +336 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/client.py +2 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/_config.py +42 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/_constants.py +2 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/_http.py +63 -2
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/_transport.py +13 -10
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_errors.py +87 -2
- glpi_python_client-0.6.12/glpi_python_client/_sync/_retry.py +90 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/auth/_v1_session.py +70 -28
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/auth/auth.py +41 -18
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/_base_client.py +24 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/__init__.py +2 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/__init__.py +4 -1
- glpi_python_client-0.6.12/glpi_python_client/_sync/clients/api/assistance/_pending_reason.py +336 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/client.py +2 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/_config.py +42 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/_constants.py +2 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/_http.py +63 -2
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/_transport.py +13 -10
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/__init__.py +4 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/__init__.py +6 -0
- glpi_python_client-0.6.12/glpi_python_client/models/api_schema/assistance/_pending_reason.py +102 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/pyproject.toml +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-asset-workflow/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-client-setup/SKILL.md +8 -4
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-contract-workflow/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-document-workflow/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-knowledge-base/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-plugin-fields/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-reporting-and-context/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-team-members/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-ticket-timeline/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-ticket-workflow/SKILL.md +3 -2
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/glpi-user-location-provisioning/SKILL.md +1 -1
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/.gitignore +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/.pre-commit-config.yaml +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/.readthedocs.yaml +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/CONTRIBUTING.md +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/LICENSE +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/README.md +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/_static/.gitkeep +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/conf.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/development.md +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/development_rtd.rst +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/index.rst +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/installation.rst +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/publishing.md +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/publishing_rtd.rst +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/docs/sponsoring.rst +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/_concurrency.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/_testing.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/auth/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/administration/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/administration/_entity.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/administration/_group.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/administration/_user.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assets/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assets/_computer.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/_team.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/_ticket.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/timeline/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/timeline/_document.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/timeline/_followup.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/timeline/_solution.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/assistance/timeline/_task.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/dropdowns/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/dropdowns/_contract_type.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/dropdowns/_itil_category.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/dropdowns/_location.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/knowledgebase/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/knowledgebase/_article.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/knowledgebase/_category.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/knowledgebase/_comment.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/knowledgebase/_revision.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/management/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/management/_contract.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/management/_document.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/plugins/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/api/plugins/_fields.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/_filters.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/commons/_payloads.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/custom/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/custom/_statistics.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_async/clients/custom/_ticket_context.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/_concurrency.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/_testing.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/auth/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/administration/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/administration/_entity.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/administration/_group.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/administration/_user.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assets/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assets/_computer.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/_team.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/_ticket.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/timeline/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/timeline/_document.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/timeline/_followup.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/timeline/_solution.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/assistance/timeline/_task.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/dropdowns/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/dropdowns/_contract_type.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/dropdowns/_itil_category.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/dropdowns/_location.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/knowledgebase/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/knowledgebase/_article.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/knowledgebase/_category.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/knowledgebase/_comment.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/knowledgebase/_revision.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/management/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/management/_contract.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/management/_document.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/plugins/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/api/plugins/_fields.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/_filters.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/commons/_payloads.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/custom/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/custom/_statistics.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/_sync/clients/custom/_ticket_context.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/content/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/content/conversion.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/_base.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/_common.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/_content.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/administration/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/administration/_entity.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/administration/_group.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/administration/_user.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/administration/_user_authorization.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assets/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assets/_computer.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assets/_contract_item.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/_team.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/_ticket.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/timeline/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/timeline/_document.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/timeline/_followup.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/timeline/_solution.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/assistance/timeline/_task.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/dropdowns/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/dropdowns/_contract_type.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/dropdowns/_itil_category.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/dropdowns/_location.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/enums.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/knowledgebase/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/knowledgebase/_article.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/knowledgebase/_category.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/knowledgebase/_comment.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/knowledgebase/_revision.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/management/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/management/_contract.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/management/_contract_cost.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/management/_document.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/management/_document_item.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/plugins/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/api_schema/plugins/_fields.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/custom_schema/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/models/custom_schema/_ticket_context.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/py.typed +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/rsql.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/testing/__init__.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/testing/fixtures.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/glpi_python_client/testing/utils.py +0 -0
- {glpi_python_client-0.6.10 → glpi_python_client-0.6.12}/skills/README.md +0 -0
|
@@ -4,6 +4,71 @@ All notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## 0.6.12 — 2026-11-23
|
|
8
|
+
|
|
9
|
+
Pending reasons, a setting that turns the automatic retries off, a typed error
|
|
10
|
+
for a success response whose body is not JSON, and v1 session renewals that
|
|
11
|
+
run once under concurrency. Retries behave as before unless the new setting is
|
|
12
|
+
passed.
|
|
13
|
+
|
|
14
|
+
There is no 0.6.11 on PyPI: its release stopped before the upload because
|
|
15
|
+
the package still declared 0.6.10, and the tag name cannot be reused. This
|
|
16
|
+
release carries the same changes.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **`list_pending_reasons`, `iter_pending_reasons`,
|
|
21
|
+
`get_ticket_pending_reason`, `set_ticket_pending_reason` and
|
|
22
|
+
`clear_ticket_pending_reason`** on both clients, from a new
|
|
23
|
+
`PendingReasonMixin`. The catalogue is read from the v2
|
|
24
|
+
`/Assistance/PendingReason` route; a ticket's pending-reason item goes
|
|
25
|
+
through the legacy v1 API, because the v2 item schema omits the
|
|
26
|
+
catalogue id and no v2 route writes an item. The three ticket methods
|
|
27
|
+
need the v1 session and raise `RuntimeError` without one.
|
|
28
|
+
`set_ticket_pending_reason` creates or updates the item after reading
|
|
29
|
+
it and does not change the ticket status.
|
|
30
|
+
- **`PendingReason` and `PendingReasonItem`** read models, exported from
|
|
31
|
+
the package root and from `glpi_python_client.models`.
|
|
32
|
+
- **`max_retries` and `retry_wait_seconds`** on both clients, on
|
|
33
|
+
`GLPITokenManager` and `GLPIV1Session`, and as `GLPI_MAX_RETRIES` and
|
|
34
|
+
`GLPI_RETRY_WAIT_SECONDS` for `from_env`. `max_retries` counts the retries
|
|
35
|
+
after the first attempt: the default `2` keeps today's 3 attempts, `0`
|
|
36
|
+
disables retrying, so a failing call raises after exactly one request.
|
|
37
|
+
`retry_wait_seconds` is the pause between attempts (default 3 seconds). The
|
|
38
|
+
setting applies to every retried call: the v2 verbs, the v1 session helpers
|
|
39
|
+
and OAuth token acquisition. Which errors are retried (network faults and
|
|
40
|
+
5xx) is unchanged.
|
|
41
|
+
- **`GlpiResponseBodyError`**, exported from the package root.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **A success response whose body is not JSON now raises `GlpiProtocolError`
|
|
46
|
+
instead of a bare `json.JSONDecodeError`.** A server or a proxy answering
|
|
47
|
+
200 with an HTML page or a garbled body used to surface a `ValueError`
|
|
48
|
+
that read like bad input. Every decode of a success body, on the v2
|
|
49
|
+
transport, the v1 session and the OAuth token manager, now goes through
|
|
50
|
+
one helper that raises the new `GlpiResponseBodyError` (a subclass of
|
|
51
|
+
`GlpiProtocolError`) with `status_code`, `url`, `content_type`,
|
|
52
|
+
`body_length` and a bounded `body_excerpt`, and chains the decode error as
|
|
53
|
+
`__cause__`. The body is kept out of the message. It is not retried: a
|
|
54
|
+
2xx means the request was processed. Empty answers on routes that accept
|
|
55
|
+
them (204, `DELETE`, v1 calls without a payload) are unchanged; an empty
|
|
56
|
+
200 on a route that must return JSON raises the same error. The lenient
|
|
57
|
+
helpers `response_json_or_empty` and `response_json_mapping` keep an
|
|
58
|
+
empty or whitespace-only body as empty but now raise the same error for a
|
|
59
|
+
non-empty body that is not JSON; the new error is a `ValueError` subclass
|
|
60
|
+
like the one it replaces, so existing `except ValueError` handlers still
|
|
61
|
+
catch it.
|
|
62
|
+
- **Concurrent renewals of the legacy v1 session.** A client shared by
|
|
63
|
+
concurrent tasks or threads renewed the v1 session once per request that
|
|
64
|
+
found the token stale (every 15 minutes by default), on the first lazy
|
|
65
|
+
`initSession`, and after a 401/403 rejection: each renewal killed the
|
|
66
|
+
token and opened a session, so a second `killSession` answered 401 and
|
|
67
|
+
one server-side session leaked per renewal. Every acquisition now takes a
|
|
68
|
+
lock and re-checks under it whether the work is still needed, so waiters
|
|
69
|
+
reuse the token the first renewal obtained and the session is killed and
|
|
70
|
+
opened once.
|
|
71
|
+
|
|
7
72
|
## 0.6.10 — 2026-11-16
|
|
8
73
|
|
|
9
74
|
A minor addition: the GLPI v2 `/Dropdowns/ITILCategory` routes, so a caller
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: glpi-python-client
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.12
|
|
4
4
|
Summary: A typed Python client for GLPI ITSM APIs.
|
|
5
5
|
Project-URL: Homepage, https://github.com/baraline/glpi_python_client
|
|
6
6
|
Project-URL: Documentation, https://glpi-python-client.readthedocs.io/en/latest/
|
|
@@ -82,6 +82,10 @@ guide for the full picture, including which methods raise which type.
|
|
|
82
82
|
:members:
|
|
83
83
|
:show-inheritance:
|
|
84
84
|
|
|
85
|
+
.. autoexception:: GlpiResponseBodyError
|
|
86
|
+
:members:
|
|
87
|
+
:show-inheritance:
|
|
88
|
+
|
|
85
89
|
.. autoexception:: GlpiContentError
|
|
86
90
|
:members:
|
|
87
91
|
:show-inheritance:
|
|
@@ -307,6 +311,25 @@ Ticket Team Members
|
|
|
307
311
|
:undoc-members:
|
|
308
312
|
:show-inheritance:
|
|
309
313
|
|
|
314
|
+
Pending reasons
|
|
315
|
+
---------------
|
|
316
|
+
|
|
317
|
+
Models for the GLPI pending-reason catalogue (v2) and a ticket's pending
|
|
318
|
+
reason item (legacy v1). The companion mixin methods are exposed on
|
|
319
|
+
:class:`GlpiClient` / :class:`AsyncGlpiClient` as ``list_pending_reasons``,
|
|
320
|
+
``iter_pending_reasons``, ``get_ticket_pending_reason``,
|
|
321
|
+
``set_ticket_pending_reason`` and ``clear_ticket_pending_reason``.
|
|
322
|
+
|
|
323
|
+
.. autoclass:: PendingReason
|
|
324
|
+
:members:
|
|
325
|
+
:undoc-members:
|
|
326
|
+
:show-inheritance:
|
|
327
|
+
|
|
328
|
+
.. autoclass:: PendingReasonItem
|
|
329
|
+
:members:
|
|
330
|
+
:undoc-members:
|
|
331
|
+
:show-inheritance:
|
|
332
|
+
|
|
310
333
|
Documents
|
|
311
334
|
---------
|
|
312
335
|
|
|
@@ -14,8 +14,8 @@ Neither is a wrapper around the other; both are the same code, as
|
|
|
14
14
|
|
|
15
15
|
Both clients speak the GLPI **v2** high-level API and fall back to the
|
|
16
16
|
legacy v1 API for features that are not exposed by v2, currently
|
|
17
|
-
binary document uploads
|
|
18
|
-
helpers. They expose the exact same endpoint methods and accept the
|
|
17
|
+
binary document uploads, the ``Fields`` plugin custom-field
|
|
18
|
+
helpers and the ticket pending-reason item methods. They expose the exact same endpoint methods and accept the
|
|
19
19
|
same constructor arguments.
|
|
20
20
|
Public methods always return Pydantic models (or simple Python types)
|
|
21
21
|
and never raw dictionaries.
|
|
@@ -117,12 +117,18 @@ Optional constructor arguments
|
|
|
117
117
|
``"en_GB"``).
|
|
118
118
|
* ``verify_ssl`` — set to ``False`` only on test instances with
|
|
119
119
|
self-signed certificates.
|
|
120
|
+
* ``max_retries`` — automatic retries after the first attempt (default
|
|
121
|
+
``2``, so 3 attempts in total); ``0`` disables retrying. See
|
|
122
|
+
:ref:`retry-behaviour`.
|
|
123
|
+
* ``retry_wait_seconds`` — pause between two attempts (default 3 seconds).
|
|
120
124
|
* ``auth_token_refresh`` — number of seconds before token expiry at
|
|
121
125
|
which the auth manager proactively refreshes the OAuth access token.
|
|
122
126
|
* ``v1_base_url`` and ``v1_user_token`` — together enable the legacy v1
|
|
123
127
|
fallback used by :meth:`GlpiClient.upload_document` and the
|
|
124
128
|
``Fields`` plugin helpers such as
|
|
125
|
-
:meth:`GlpiClient.get_ticket_custom_fields
|
|
129
|
+
:meth:`GlpiClient.get_ticket_custom_fields`, and the ticket
|
|
130
|
+
pending-reason methods such as
|
|
131
|
+
:meth:`GlpiClient.set_ticket_pending_reason`.
|
|
126
132
|
|
|
127
133
|
``from_env``
|
|
128
134
|
~~~~~~~~~~~~
|
|
@@ -142,6 +148,7 @@ build the client for you:
|
|
|
142
148
|
offset. There is no default: guessing UTC against a Europe/Paris instance
|
|
143
149
|
shifts those values by an hour or two and never raises.
|
|
144
150
|
* ``GLPI_LANGUAGE``, ``GLPI_VERIFY_SSL``
|
|
151
|
+
* ``GLPI_MAX_RETRIES``, ``GLPI_RETRY_WAIT_SECONDS`` -- see :ref:`retry-behaviour`.
|
|
145
152
|
* ``GLPI_V1_BASE_URL``, ``GLPI_V1_USER_TOKEN``, ``GLPI_V1_APP_TOKEN``
|
|
146
153
|
|
|
147
154
|
.. code-block:: python
|
|
@@ -1080,6 +1087,64 @@ to ``list_item_plugin_field_rows``, ``create_item_plugin_field_row``,
|
|
|
1080
1087
|
or ``update_item_plugin_field_row`` only when you need the raw v1 row
|
|
1081
1088
|
shape.
|
|
1082
1089
|
|
|
1090
|
+
Pending reasons
|
|
1091
|
+
~~~~~~~~~~~~~~~
|
|
1092
|
+
|
|
1093
|
+
A pause is ticket status ``4`` (Pending) plus at most one item linking
|
|
1094
|
+
the ticket to an entry of the pending-reason catalogue. The catalogue is
|
|
1095
|
+
read from the v2 API; the ticket's item needs the legacy v1 session
|
|
1096
|
+
(``v1_base_url`` and ``v1_user_token``), because the v2 item schema does
|
|
1097
|
+
not say *which* reason a ticket carries and no v2 route writes an item.
|
|
1098
|
+
Without the v1 session the three ticket methods raise ``RuntimeError``.
|
|
1099
|
+
|
|
1100
|
+
.. code-block:: python
|
|
1101
|
+
|
|
1102
|
+
from glpi_python_client import GlpiClient, GlpiTicketStatus, PatchTicket
|
|
1103
|
+
|
|
1104
|
+
with GlpiClient(
|
|
1105
|
+
glpi_api_url="https://glpi.example.com/api.php/v2",
|
|
1106
|
+
server_timezone="Europe/Paris",
|
|
1107
|
+
client_id="oauth-client-id",
|
|
1108
|
+
client_secret="oauth-client-secret",
|
|
1109
|
+
username="api-user",
|
|
1110
|
+
password="api-password",
|
|
1111
|
+
v1_base_url="https://glpi.example.com/apirest.php",
|
|
1112
|
+
v1_user_token="legacy-user-token",
|
|
1113
|
+
) as client:
|
|
1114
|
+
reasons = client.list_pending_reasons()
|
|
1115
|
+
reason = reasons[0]
|
|
1116
|
+
|
|
1117
|
+
# The status is the caller's to set: the item alone does not pause.
|
|
1118
|
+
client.update_ticket(ticket_id, PatchTicket(status=GlpiTicketStatus.PENDING))
|
|
1119
|
+
item = client.set_ticket_pending_reason(
|
|
1120
|
+
ticket_id,
|
|
1121
|
+
reason.id,
|
|
1122
|
+
followup_frequency=reason.followup_frequency or 0,
|
|
1123
|
+
followups_before_resolution=reason.followups_before_resolution or 0,
|
|
1124
|
+
)
|
|
1125
|
+
print(item.pendingreasons_id)
|
|
1126
|
+
|
|
1127
|
+
print(client.get_ticket_pending_reason(ticket_id)) # item or None
|
|
1128
|
+
|
|
1129
|
+
client.clear_ticket_pending_reason(ticket_id) # True, or False if none
|
|
1130
|
+
|
|
1131
|
+
Things worth knowing:
|
|
1132
|
+
|
|
1133
|
+
* ``set_ticket_pending_reason`` creates the item when the ticket has none
|
|
1134
|
+
and changes it otherwise, so it avoids GLPI's duplicate-key error
|
|
1135
|
+
unless another writer creates the item between its read and its write.
|
|
1136
|
+
It does **not** change the ticket status. An item set on a ticket that
|
|
1137
|
+
is not pending is stored but has no effect; GLPI removes an item when
|
|
1138
|
+
its ticket leaves status ``4``, but one set on a ticket that never was
|
|
1139
|
+
pending is not known to be cleaned up, so clear it explicitly.
|
|
1140
|
+
* The item does not copy the catalogue's ``followup_frequency``: pass the
|
|
1141
|
+
frequencies wanted, or the item stores ``0``.
|
|
1142
|
+
* ``clear_ticket_pending_reason`` leaves the ticket at status ``4``,
|
|
1143
|
+
without a reason. Leaving status ``4`` removes the item by itself.
|
|
1144
|
+
* A reason id that is not in the catalogue is stored without error.
|
|
1145
|
+
* None of these calls adds a followup to the timeline. The GLPI web
|
|
1146
|
+
interface pauses through a followup, which does.
|
|
1147
|
+
|
|
1083
1148
|
Aggregated ticket context
|
|
1084
1149
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
1085
1150
|
|
|
@@ -1776,7 +1841,8 @@ Connection failures, DNS errors and timeouts are translated into
|
|
|
1776
1841
|
:class:`~glpi_python_client.GlpiTimeoutError` subclass for a timeout --
|
|
1777
1842
|
so you never need to import the HTTP library to catch them. The original
|
|
1778
1843
|
transport exception stays attached as ``__cause__`` for debugging, and
|
|
1779
|
-
these faults are retried three
|
|
1844
|
+
these faults are retried (three attempts by default, see
|
|
1845
|
+
:ref:`retry-behaviour`) before they surface:
|
|
1780
1846
|
|
|
1781
1847
|
.. code-block:: python
|
|
1782
1848
|
|
|
@@ -1806,10 +1872,11 @@ The hierarchy lets you narrow as far as you need:
|
|
|
1806
1872
|
├── GlpiStatusError GLPI answered with an unexpected status
|
|
1807
1873
|
│ ├── GlpiAuthError 401 / 403
|
|
1808
1874
|
│ ├── GlpiNotFoundError 404
|
|
1809
|
-
│ └── GlpiServerError 5xx (retried
|
|
1875
|
+
│ └── GlpiServerError 5xx (retried, 3 attempts by default, before it
|
|
1810
1876
|
│ reaches you)
|
|
1811
1877
|
├── GlpiValidationError the client rejected your argument
|
|
1812
1878
|
├── GlpiProtocolError GLPI answered 2xx with an unusable body
|
|
1879
|
+
│ └── GlpiResponseBodyError the 2xx body is not JSON
|
|
1813
1880
|
└── GlpiContentError a rich-text body could not be converted
|
|
1814
1881
|
between HTML and Markdown
|
|
1815
1882
|
|
|
@@ -1827,6 +1894,35 @@ usually want:
|
|
|
1827
1894
|
print(exc.url) # the absolute URL that was requested
|
|
1828
1895
|
print(exc.response_text) # the response body
|
|
1829
1896
|
|
|
1897
|
+
A success status does not guarantee a usable body. When a server, or a
|
|
1898
|
+
proxy in front of it, answers 2xx with an HTML page, a garbled body or
|
|
1899
|
+
nothing at all on a route that must return a payload, the client raises
|
|
1900
|
+
:class:`~glpi_python_client.GlpiResponseBodyError`, a
|
|
1901
|
+
:class:`~glpi_python_client.GlpiProtocolError`, instead of a bare
|
|
1902
|
+
``json.JSONDecodeError``. The request was sent and answered, so the failure
|
|
1903
|
+
is the response, not your arguments:
|
|
1904
|
+
|
|
1905
|
+
.. code-block:: python
|
|
1906
|
+
|
|
1907
|
+
from glpi_python_client import GlpiResponseBodyError
|
|
1908
|
+
|
|
1909
|
+
try:
|
|
1910
|
+
ticket = client.get_ticket(1)
|
|
1911
|
+
except GlpiResponseBodyError as exc:
|
|
1912
|
+
print(exc.status_code) # 200
|
|
1913
|
+
print(exc.url) # the absolute URL that was requested
|
|
1914
|
+
print(exc.content_type) # for example "text/html"
|
|
1915
|
+
print(exc.body_length) # body size in bytes
|
|
1916
|
+
print(exc.body_excerpt) # first 200 bytes (UTF-8, replacement), for diagnostics
|
|
1917
|
+
|
|
1918
|
+
The decode error is chained as ``__cause__``. The message names the status,
|
|
1919
|
+
URL, content type and length but never the body, which may carry data. The
|
|
1920
|
+
error is **not** retried: a 2xx means the request was processed, and
|
|
1921
|
+
sending a write again could apply it twice. Routes that deliberately accept
|
|
1922
|
+
an empty answer (a 204, a ``DELETE``, a v1 call with no payload) still
|
|
1923
|
+
return normally; an empty 200 on a route that must return a payload raises
|
|
1924
|
+
the same error with ``body_length == 0``.
|
|
1925
|
+
|
|
1830
1926
|
.. note::
|
|
1831
1927
|
|
|
1832
1928
|
:class:`~glpi_python_client.GlpiStatusError`,
|
|
@@ -2222,27 +2318,44 @@ definition list's newline becomes a hard break. Bold inside bold
|
|
|
2222
2318
|
link or image title loses a backslash before punctuation. The caption,
|
|
2223
2319
|
colgroup and image-title shapes above settle too, on what they already lost.
|
|
2224
2320
|
|
|
2321
|
+
.. _retry-behaviour:
|
|
2322
|
+
|
|
2225
2323
|
Retry behaviour
|
|
2226
2324
|
~~~~~~~~~~~~~~~
|
|
2227
2325
|
|
|
2228
|
-
|
|
2229
|
-
(
|
|
2230
|
-
:class:`~glpi_python_client.GlpiServerError`
|
|
2231
|
-
(4xx) are never retried — they cannot succeed on a second
|
|
2326
|
+
Every v2 verb, every v1-session helper and OAuth token acquisition retry a
|
|
2327
|
+
network fault (:class:`~glpi_python_client.GlpiTransportError`) or a server
|
|
2328
|
+
error (5xx, :class:`~glpi_python_client.GlpiServerError`) before it reaches
|
|
2329
|
+
you. Client errors (4xx) are never retried — they cannot succeed on a second
|
|
2330
|
+
attempt. The two client settings below govern all of these calls alike,
|
|
2331
|
+
token acquisition included; which errors are retried does not depend on them:
|
|
2332
|
+
|
|
2333
|
+
* ``max_retries`` — retries after the first attempt. The default ``2`` makes
|
|
2334
|
+
3 attempts in total; ``0`` disables retrying, so a failing call raises after
|
|
2335
|
+
exactly one request. Use ``0`` when your own code owns the retry policy: a
|
|
2336
|
+
retried write may already have been applied.
|
|
2337
|
+
* ``retry_wait_seconds`` — fixed pause between two attempts (default 3
|
|
2338
|
+
seconds; ``None`` keeps it).
|
|
2339
|
+
|
|
2340
|
+
.. code-block:: python
|
|
2341
|
+
|
|
2342
|
+
client = GlpiClient.from_env(max_retries=0) # or GLPI_MAX_RETRIES=0
|
|
2343
|
+
|
|
2344
|
+
The counts below are those of the default setting (3 attempts).
|
|
2232
2345
|
|
|
2233
|
-
OAuth token acquisition follows the same
|
|
2346
|
+
OAuth token acquisition follows the same policy, with one
|
|
2234
2347
|
exception: refreshing an already-issued token does not raise directly on
|
|
2235
2348
|
a failed response. It logs a warning and falls through to a fresh token
|
|
2236
|
-
acquisition, which carries its own independent
|
|
2237
|
-
|
|
2349
|
+
acquisition, which carries its own independent retry decorator. The
|
|
2350
|
+
refresh method's own retry decorator only retries a
|
|
2238
2351
|
network-level fault on the refresh request itself (a
|
|
2239
2352
|
:class:`~glpi_python_client.GlpiTransportError` raised before any
|
|
2240
2353
|
response is received) —
|
|
2241
2354
|
it does **not** retry a :class:`~glpi_python_client.GlpiServerError`
|
|
2242
2355
|
from the fall-through, since that failure is already being retried by
|
|
2243
2356
|
the nested acquisition call. A persistent 5xx encountered while
|
|
2244
|
-
refreshing therefore costs
|
|
2245
|
-
acquisition POSTs = 4 POST requests before
|
|
2357
|
+
refreshing therefore costs, with the default setting, exactly 1 refresh
|
|
2358
|
+
POST + up to 3 nested acquisition POSTs = 4 POST requests before
|
|
2246
2359
|
:class:`~glpi_python_client.GlpiServerError` reaches you. A rejected
|
|
2247
2360
|
credential (401/403) is not retried at either layer and fails after at
|
|
2248
2361
|
most 2 POST requests.
|
|
@@ -24,6 +24,7 @@ from glpi_python_client._errors import (
|
|
|
24
24
|
GlpiError,
|
|
25
25
|
GlpiNotFoundError,
|
|
26
26
|
GlpiProtocolError,
|
|
27
|
+
GlpiResponseBodyError,
|
|
27
28
|
GlpiServerError,
|
|
28
29
|
GlpiStatusError,
|
|
29
30
|
GlpiTimeoutError,
|
|
@@ -112,6 +113,8 @@ from glpi_python_client.models import (
|
|
|
112
113
|
PatchTicketTask,
|
|
113
114
|
PatchTimelineDocument,
|
|
114
115
|
PatchUser,
|
|
116
|
+
PendingReason,
|
|
117
|
+
PendingReasonItem,
|
|
115
118
|
PostComputer,
|
|
116
119
|
PostContract,
|
|
117
120
|
PostContractCost,
|
|
@@ -142,7 +145,7 @@ from glpi_python_client.rsql import (
|
|
|
142
145
|
date_window,
|
|
143
146
|
)
|
|
144
147
|
|
|
145
|
-
__version__ = "0.6.
|
|
148
|
+
__version__ = "0.6.12"
|
|
146
149
|
|
|
147
150
|
__all__ = [
|
|
148
151
|
"AsyncGlpiClient",
|
|
@@ -202,6 +205,7 @@ __all__ = [
|
|
|
202
205
|
"GlpiNotFoundError",
|
|
203
206
|
"GlpiPriority",
|
|
204
207
|
"GlpiProtocolError",
|
|
208
|
+
"GlpiResponseBodyError",
|
|
205
209
|
"GlpiServerError",
|
|
206
210
|
"GlpiSolutionStatus",
|
|
207
211
|
"GlpiStatusError",
|
|
@@ -237,6 +241,8 @@ __all__ = [
|
|
|
237
241
|
"PatchTicketTask",
|
|
238
242
|
"PatchTimelineDocument",
|
|
239
243
|
"PatchUser",
|
|
244
|
+
"PendingReason",
|
|
245
|
+
"PendingReasonItem",
|
|
240
246
|
"PostComputer",
|
|
241
247
|
"PostContract",
|
|
242
248
|
"PostContractCost",
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Configurable retry policy shared by the v2 transport, v1 session and OAuth.
|
|
2
|
+
|
|
3
|
+
Every network-facing helper of the client retries a transient failure. The
|
|
4
|
+
policy is a per-client setting, not a decorator fixed at import time, so the
|
|
5
|
+
decorator built here reads two attributes from the object it decorates:
|
|
6
|
+
|
|
7
|
+
``_max_retries``
|
|
8
|
+
Retries after the first attempt. ``0`` disables retrying.
|
|
9
|
+
``_retry_wait_seconds``
|
|
10
|
+
Fixed pause between attempts; ``None`` selects
|
|
11
|
+
:data:`DEFAULT_RETRY_WAIT_SECONDS`.
|
|
12
|
+
|
|
13
|
+
Which errors are retried is decided by each call site (``retry_on``), not by
|
|
14
|
+
the setting.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import functools
|
|
20
|
+
from collections.abc import Callable
|
|
21
|
+
from typing import Any, TypeVar, cast
|
|
22
|
+
|
|
23
|
+
from tenacity import (
|
|
24
|
+
AsyncRetrying,
|
|
25
|
+
retry_if_exception_type,
|
|
26
|
+
stop_after_attempt,
|
|
27
|
+
wait_fixed,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
from glpi_python_client._errors import GlpiValidationError
|
|
31
|
+
|
|
32
|
+
#: Retries after the first attempt (3 attempts in total).
|
|
33
|
+
DEFAULT_MAX_RETRIES = 2
|
|
34
|
+
|
|
35
|
+
#: Seconds between two attempts when no wait is configured.
|
|
36
|
+
DEFAULT_RETRY_WAIT_SECONDS = 3.0
|
|
37
|
+
|
|
38
|
+
F = TypeVar("F", bound=Callable[..., Any])
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def validate_retry_settings(
|
|
42
|
+
max_retries: object, retry_wait_seconds: object
|
|
43
|
+
) -> tuple[int, float | None]:
|
|
44
|
+
"""Return the validated ``(max_retries, retry_wait_seconds)`` pair.
|
|
45
|
+
|
|
46
|
+
Raises
|
|
47
|
+
------
|
|
48
|
+
GlpiValidationError
|
|
49
|
+
If ``max_retries`` is not an integer >= 0, or ``retry_wait_seconds``
|
|
50
|
+
is neither ``None`` nor a number >= 0.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
if (
|
|
54
|
+
isinstance(max_retries, bool)
|
|
55
|
+
or not isinstance(max_retries, int)
|
|
56
|
+
or max_retries < 0
|
|
57
|
+
):
|
|
58
|
+
raise GlpiValidationError("max_retries must be an integer >= 0")
|
|
59
|
+
if retry_wait_seconds is not None and (
|
|
60
|
+
isinstance(retry_wait_seconds, bool)
|
|
61
|
+
or not isinstance(retry_wait_seconds, int | float)
|
|
62
|
+
or retry_wait_seconds < 0
|
|
63
|
+
):
|
|
64
|
+
raise GlpiValidationError("retry_wait_seconds must be a number >= 0 or None")
|
|
65
|
+
return max_retries, retry_wait_seconds
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def retried(
|
|
69
|
+
retry_on: type[BaseException] | tuple[type[BaseException], ...],
|
|
70
|
+
) -> Callable[[F], F]:
|
|
71
|
+
"""Retry the decorated method on ``retry_on`` per its instance's policy.
|
|
72
|
+
|
|
73
|
+
The final error is re-raised as-is, never as ``tenacity.RetryError``.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
def decorator(func: F) -> F:
|
|
77
|
+
@functools.wraps(func)
|
|
78
|
+
async def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
|
|
79
|
+
wait = self._retry_wait_seconds
|
|
80
|
+
retrying = AsyncRetrying(
|
|
81
|
+
retry=retry_if_exception_type(retry_on),
|
|
82
|
+
stop=stop_after_attempt(self._max_retries + 1),
|
|
83
|
+
wait=wait_fixed(DEFAULT_RETRY_WAIT_SECONDS if wait is None else wait),
|
|
84
|
+
reraise=True,
|
|
85
|
+
)
|
|
86
|
+
return await retrying(func, self, *args, **kwargs)
|
|
87
|
+
|
|
88
|
+
return cast(F, wrapper)
|
|
89
|
+
|
|
90
|
+
return decorator
|
|
@@ -13,11 +13,16 @@ The session wrapper owns the authenticated v1 lifecycle (init, refresh,
|
|
|
13
13
|
kill) and exposes the typed ``upload_document`` helper plus the generic
|
|
14
14
|
``request_json`` JSON-only HTTP helper that newer mixins build on.
|
|
15
15
|
|
|
16
|
+
Session renewal is serialised by a lock and the need is re-checked under it,
|
|
17
|
+
so concurrent requests share one new session instead of each renewing.
|
|
18
|
+
|
|
16
19
|
Retry policy
|
|
17
20
|
------------
|
|
18
21
|
Every public dispatch helper (``_init_session``, ``request_json``,
|
|
19
22
|
``upload_document``) carries the same :mod:`tenacity` retry decorator
|
|
20
|
-
used by the v2 transport: three attempts spaced by three
|
|
23
|
+
used by the v2 transport: by default three attempts spaced by three
|
|
24
|
+
seconds (the ``max_retries`` and ``retry_wait_seconds`` client settings,
|
|
25
|
+
``max_retries=0`` disables retrying),
|
|
21
26
|
triggered by :class:`~glpi_python_client.GlpiTransportError` (network
|
|
22
27
|
faults) and
|
|
23
28
|
:class:`~glpi_python_client.GlpiServerError` (which
|
|
@@ -41,10 +46,16 @@ from datetime import UTC, datetime, timedelta
|
|
|
41
46
|
from typing import Any, cast
|
|
42
47
|
|
|
43
48
|
import httpx
|
|
44
|
-
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
|
|
45
49
|
|
|
50
|
+
from glpi_python_client._async._concurrency import Lock
|
|
51
|
+
from glpi_python_client._async._retry import (
|
|
52
|
+
DEFAULT_MAX_RETRIES,
|
|
53
|
+
retried,
|
|
54
|
+
validate_retry_settings,
|
|
55
|
+
)
|
|
46
56
|
from glpi_python_client._async.clients.commons._config import build_http_session
|
|
47
57
|
from glpi_python_client._async.clients.commons._http import (
|
|
58
|
+
decode_json_body,
|
|
48
59
|
ensure_response_status,
|
|
49
60
|
finalize_request_response,
|
|
50
61
|
response_json_or_empty,
|
|
@@ -66,12 +77,7 @@ _AUTH_FAILURE_STATUS_CODES = frozenset({401, 403})
|
|
|
66
77
|
#: Mirrors the v2 transport policy deliberately: naming the HTTP library's
|
|
67
78
|
#: own exception base here would make the retries stop matching — silently —
|
|
68
79
|
#: the next time the transport changes.
|
|
69
|
-
_RETRY_ON_NETWORK_ERRORS =
|
|
70
|
-
retry=retry_if_exception_type((GlpiTransportError, GlpiServerError)),
|
|
71
|
-
stop=stop_after_attempt(3),
|
|
72
|
-
wait=wait_fixed(3),
|
|
73
|
-
reraise=True,
|
|
74
|
-
)
|
|
80
|
+
_RETRY_ON_NETWORK_ERRORS = retried((GlpiTransportError, GlpiServerError))
|
|
75
81
|
|
|
76
82
|
|
|
77
83
|
class GLPIV1Session:
|
|
@@ -92,10 +98,15 @@ class GLPIV1Session:
|
|
|
92
98
|
session_refresh_interval_seconds: int = (
|
|
93
99
|
_DEFAULT_SESSION_REFRESH_INTERVAL_SECONDS
|
|
94
100
|
),
|
|
101
|
+
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
102
|
+
retry_wait_seconds: float | None = None,
|
|
95
103
|
) -> None:
|
|
96
104
|
self._base_url = base_url.rstrip("/")
|
|
97
105
|
self._user_token = user_token
|
|
98
106
|
self._app_token = app_token
|
|
107
|
+
self._max_retries, self._retry_wait_seconds = validate_retry_settings(
|
|
108
|
+
max_retries, retry_wait_seconds
|
|
109
|
+
)
|
|
99
110
|
if session_refresh_interval_seconds < 1:
|
|
100
111
|
raise GlpiValidationError(
|
|
101
112
|
"session_refresh_interval_seconds must be a positive integer"
|
|
@@ -111,6 +122,11 @@ class GLPIV1Session:
|
|
|
111
122
|
|
|
112
123
|
self._session_token: str | None = None
|
|
113
124
|
self._session_started_at: datetime | None = None
|
|
125
|
+
# Serialises every acquisition or replacement of the session token.
|
|
126
|
+
# It is not re-entrant: only ``_ensure_session``,
|
|
127
|
+
# ``_renew_rejected_session`` and ``close`` take it, and none of them
|
|
128
|
+
# calls another of them (or ``_headers``) while holding it.
|
|
129
|
+
self._session_lock = Lock()
|
|
114
130
|
|
|
115
131
|
async def _dispatch(self, method: str, url: str, **kwargs: Any) -> httpx.Response:
|
|
116
132
|
"""Send one raw v1 HTTP call, translating transport faults.
|
|
@@ -165,7 +181,8 @@ class GLPIV1Session:
|
|
|
165
181
|
failure_message="GLPI v1 initSession failed",
|
|
166
182
|
)
|
|
167
183
|
|
|
168
|
-
|
|
184
|
+
body = decode_json_body(response)
|
|
185
|
+
token = body.get("session_token") if isinstance(body, dict) else None
|
|
169
186
|
if not token:
|
|
170
187
|
raise GlpiProtocolError("GLPI v1 initSession returned no session_token")
|
|
171
188
|
|
|
@@ -178,13 +195,32 @@ class GLPIV1Session:
|
|
|
178
195
|
|
|
179
196
|
The helper is called by every authenticated request before any header
|
|
180
197
|
construction so callers never have to manage the lifecycle directly.
|
|
198
|
+
Concurrent callers are serialised and the need is re-tested under the
|
|
199
|
+
lock, so a caller that waited reuses the token the first one obtained.
|
|
181
200
|
"""
|
|
182
201
|
|
|
183
|
-
if self._session_token is None:
|
|
184
|
-
await self._init_session()
|
|
202
|
+
if self._session_token is not None and not self._is_session_stale():
|
|
185
203
|
return
|
|
186
|
-
|
|
187
|
-
|
|
204
|
+
async with self._session_lock:
|
|
205
|
+
if self._session_token is None:
|
|
206
|
+
await self._init_session()
|
|
207
|
+
elif self._is_session_stale():
|
|
208
|
+
logger.info(
|
|
209
|
+
"GLPI v1 session reached refresh interval; renewing session."
|
|
210
|
+
)
|
|
211
|
+
await self._renew_session()
|
|
212
|
+
|
|
213
|
+
async def _renew_rejected_session(self, rejected_token: str | None) -> None:
|
|
214
|
+
"""Renew the session after the server rejected ``rejected_token``.
|
|
215
|
+
|
|
216
|
+
Under the lock the current token is compared with the rejected one:
|
|
217
|
+
when another request already replaced it, the new token is reused
|
|
218
|
+
and nothing is killed or opened.
|
|
219
|
+
"""
|
|
220
|
+
|
|
221
|
+
async with self._session_lock:
|
|
222
|
+
if self._session_token != rejected_token:
|
|
223
|
+
return
|
|
188
224
|
await self._renew_session()
|
|
189
225
|
|
|
190
226
|
def _is_session_stale(self) -> bool:
|
|
@@ -218,6 +254,8 @@ class GLPIV1Session:
|
|
|
218
254
|
async def _renew_session(self) -> None:
|
|
219
255
|
"""Drop the current GLPI v1 session token and acquire a new one.
|
|
220
256
|
|
|
257
|
+
The caller must hold ``_session_lock``; the helper never takes it.
|
|
258
|
+
|
|
221
259
|
The previous token is best-effort killed so the GLPI server can release
|
|
222
260
|
the associated session state immediately. ``_init_session`` will set
|
|
223
261
|
the new token on success or raise, leaving the existing state
|
|
@@ -267,7 +305,8 @@ class GLPIV1Session:
|
|
|
267
305
|
the caller to validate with :func:`ensure_response_status`.
|
|
268
306
|
"""
|
|
269
307
|
|
|
270
|
-
|
|
308
|
+
session_headers = await self._headers()
|
|
309
|
+
request_headers = {**session_headers, **(headers or {})}
|
|
271
310
|
# Dispatch through ``request(method, ...)`` rather than looking up a
|
|
272
311
|
# per-verb attribute: it is the one call shape both transports share,
|
|
273
312
|
# and it keeps the verb a value instead of an attribute name.
|
|
@@ -278,7 +317,7 @@ class GLPIV1Session:
|
|
|
278
317
|
"GLPI v1 session token was rejected; refreshing session and "
|
|
279
318
|
"retrying request once."
|
|
280
319
|
)
|
|
281
|
-
await self.
|
|
320
|
+
await self._renew_rejected_session(session_headers["Session-Token"])
|
|
282
321
|
request_headers = {**await self._headers(), **(headers or {})}
|
|
283
322
|
response = await self._dispatch(
|
|
284
323
|
verb, url, headers=request_headers, **kwargs
|
|
@@ -299,19 +338,22 @@ class GLPIV1Session:
|
|
|
299
338
|
"""
|
|
300
339
|
|
|
301
340
|
try:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
341
|
+
async with self._session_lock:
|
|
342
|
+
try:
|
|
343
|
+
if self._session_token is not None:
|
|
344
|
+
await self._dispatch(
|
|
345
|
+
"GET",
|
|
346
|
+
f"{self._base_url}/killSession",
|
|
347
|
+
headers=self._session_headers(),
|
|
348
|
+
timeout=10,
|
|
349
|
+
)
|
|
350
|
+
logger.info("GLPI v1 session killed.")
|
|
351
|
+
except Exception:
|
|
352
|
+
logger.warning("Failed to kill GLPI v1 session.", exc_info=True)
|
|
353
|
+
finally:
|
|
354
|
+
self._session_token = None
|
|
355
|
+
self._session_started_at = None
|
|
312
356
|
finally:
|
|
313
|
-
self._session_token = None
|
|
314
|
-
self._session_started_at = None
|
|
315
357
|
await self._http.aclose()
|
|
316
358
|
|
|
317
359
|
@_RETRY_ON_NETWORK_ERRORS
|
|
@@ -441,7 +483,7 @@ class GLPIV1Session:
|
|
|
441
483
|
success_statuses=(200, 201),
|
|
442
484
|
failure_message="GLPI v1 document upload failed",
|
|
443
485
|
)
|
|
444
|
-
payload = response
|
|
486
|
+
payload = decode_json_body(response)
|
|
445
487
|
if not isinstance(payload, dict):
|
|
446
488
|
raise GlpiProtocolError(
|
|
447
489
|
"GLPI v1 document upload returned unexpected payload: "
|