Skip to content

APPTOKEN is mandatory in python-glpi-api, while optional by GLPI #31

@AldarisPale

Description

@AldarisPale

First of all, thank you for your work on this!

I noticed an aspect. apirest.php states (random internet accessible instance is for example at https://suporte.inss.gov.br/glpi/apirest.php/ ) this:
"App-Token: authorization string provided by the GLPI API configuration. Optional." in the "Init Session" section.

Currently python-glpi-api requires apptoken:

  1. 'App-Token': apptoken
  2. 'App-Token': apptoken

Leaving aside documentation aspect, the following patches should fix these.

Currently from L148

  # Set required headers.
        headers = {
            'Content-Type': 'application/json',
            'Session-Token': session_token,
            'App-Token': apptoken
        }

To:

  # Set required headers.
        headers = {
            'Content-Type': 'application/json',
            'Session-Token': session_token,
        }
        if apptoken:
            headers['App-Token'] = apptoken

Currently from L174

        init_headers = {
            'Content-Type': 'application/json',
            'App-Token': apptoken
        }

To:

        init_headers = {
            'Content-Type': 'application/json',
        }
        if apptoken:
            init_headers['App-Token'] = apptoken

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions