glpi-provider


Nameglpi-provider JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryGLPI API Abstraction Layer
upload_time2024-11-12 19:23:25
maintainerNone
docs_urlNone
authorTatianno Alves
requires_pythonNone
licenseMIT License
keywords glpi provider api rest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GLPI API Abstraction Layer

This project provides an abstraction layer to simplify the use of the GLPI REST API, making it easier to interact with entities, tickets, and users. It offers a Python interface to streamline communication with the GLPI API in an organized and reusable way.

## Repository

Github: https://github.com/Gnew-Solucoes-IP-Ltda/glpi-provider

## Requirements
  - Python 3.10 +
  - Library for GLPI API communication

## Structure

The project includes the `GlpiProvider` class in `glpi_provider`, which encapsulates various methods to interact with the GLPI API:

- **Authentication**:
  - `create_session()`: Creates an authentication session with the API.
  - `close_session()`: Ends the authentication session.

- **Entities**:
  - `get_entity(entity_id: int)`: Retrieves a specific entity by its ID.
  - `get_entities()`: Retrieves all entities.

- **Tickets**:
  - `get_ticket(ticket_id: int)`: Retrieves a specific ticket by its ID.
  - `get_tickets()`: Retrieves all tickets.
  - `get_open_tickets()`: Retrieves only open tickets.

- **Users**:
  - `get_user(user_id: int)`: Retrieves a specific user by their ID.
  - `get_users()`: Retrieves all users.

## Environment Variables

To configure the connection to the GLPI API, create a `.env` file in the project root directory with the following variables:

```env
GLPI_BASE_URL='GLPI_BASE_URL'
GLPI_USER_TOKEN='GLPI_USER_TOKEN'
GLPI_TICKET_STATUS=[1, 2, 3, 4]
```
  - `GLPI_BASE_URL`: The base URL for the GLPI API.
  - `GLPI_USER_TOKEN`: The user token for authenticating API requests.
  - `GLPI_TICKET_STATUS`: A list of ticket statuses to filter tickets when calling methods like get_open_tickets().

## Usage Example

Below is an example of how to use the abstraction layer to retrieve open tickets:

```python
from glpi_provider import GlpiProvider

# Initialize the GLPI provider and create a session
provider = GlpiProvider()
provider.create_session()

# Retrieve and print the list of open tickets
tickets = provider.get_open_tickets()
print(tickets)

# Close the session with the API
provider.close_session()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "glpi-provider",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "glpi provider api rest",
    "author": "Tatianno Alves",
    "author_email": "tferreiraalves@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# GLPI API Abstraction Layer\n\nThis project provides an abstraction layer to simplify the use of the GLPI REST API, making it easier to interact with entities, tickets, and users. It offers a Python interface to streamline communication with the GLPI API in an organized and reusable way.\n\n## Repository\n\nGithub: https://github.com/Gnew-Solucoes-IP-Ltda/glpi-provider\n\n## Requirements\n  - Python 3.10 +\n  - Library for GLPI API communication\n\n## Structure\n\nThe project includes the `GlpiProvider` class in `glpi_provider`, which encapsulates various methods to interact with the GLPI API:\n\n- **Authentication**:\n  - `create_session()`: Creates an authentication session with the API.\n  - `close_session()`: Ends the authentication session.\n\n- **Entities**:\n  - `get_entity(entity_id: int)`: Retrieves a specific entity by its ID.\n  - `get_entities()`: Retrieves all entities.\n\n- **Tickets**:\n  - `get_ticket(ticket_id: int)`: Retrieves a specific ticket by its ID.\n  - `get_tickets()`: Retrieves all tickets.\n  - `get_open_tickets()`: Retrieves only open tickets.\n\n- **Users**:\n  - `get_user(user_id: int)`: Retrieves a specific user by their ID.\n  - `get_users()`: Retrieves all users.\n\n## Environment Variables\n\nTo configure the connection to the GLPI API, create a `.env` file in the project root directory with the following variables:\n\n```env\nGLPI_BASE_URL='GLPI_BASE_URL'\nGLPI_USER_TOKEN='GLPI_USER_TOKEN'\nGLPI_TICKET_STATUS=[1, 2, 3, 4]\n```\n  - `GLPI_BASE_URL`: The base URL for the GLPI API.\n  - `GLPI_USER_TOKEN`: The user token for authenticating API requests.\n  - `GLPI_TICKET_STATUS`: A list of ticket statuses to filter tickets when calling methods like get_open_tickets().\n\n## Usage Example\n\nBelow is an example of how to use the abstraction layer to retrieve open tickets:\n\n```python\nfrom glpi_provider import GlpiProvider\n\n# Initialize the GLPI provider and create a session\nprovider = GlpiProvider()\nprovider.create_session()\n\n# Retrieve and print the list of open tickets\ntickets = provider.get_open_tickets()\nprint(tickets)\n\n# Close the session with the API\nprovider.close_session()\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "GLPI API Abstraction Layer",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "glpi",
        "provider",
        "api",
        "rest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f80217e4e231a2185cf684fca17a76019f1c91237ac14068602a1c0965f5ea46",
                "md5": "429913b1eaf577e485c158afe2df8b80",
                "sha256": "d04062a9c879cf40c12436ab7106be2af7c607b3adc9f7a7f084e9a7db66b6bd"
            },
            "downloads": -1,
            "filename": "glpi_provider-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "429913b1eaf577e485c158afe2df8b80",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 25997,
            "upload_time": "2024-11-12T19:23:25",
            "upload_time_iso_8601": "2024-11-12T19:23:25.312459Z",
            "url": "https://files.pythonhosted.org/packages/f8/02/17e4e231a2185cf684fca17a76019f1c91237ac14068602a1c0965f5ea46/glpi_provider-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 19:23:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "glpi-provider"
}
        
Elapsed time: 0.36292s