Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "user_token "+self.token_auth TypeError: can only concatenate str (not "tuple") to str #32

Open
wtccosta opened this issue Aug 23, 2019 · 5 comments

Comments

@wtccosta
Copy link

When I try to run the installation guide examples, such as listing tickets, this error appears:
"user_token "+self.token_auth
Traceback (most recent call last):
File "C:/Users/warde/PycharmProjects/pyGLPI/connection.py", line 13, in
glpi.get_all('ticket')
File "c:\users\warde\pycharmprojects\pyglpi\venv\src\glpi\glpi\glpi.py", line 589, in get_all
self.init_api()
File "c:\users\warde\pycharmprojects\pyglpi\venv\src\glpi\glpi\glpi.py", line 544, in init_api
self.api_session = self.api_rest.get_session_token()
File "c:\users\warde\pycharmprojects\pyglpi\venv\src\glpi\glpi\glpi.py", line 271, in get_session_token
self.set_session_token()
File "c:\users\warde\pycharmprojects\pyglpi\venv\src\glpi\glpi\glpi.py", line 211, in set_session_token
headers["Authorization"] = "user_token "+self.token_auth
TypeError: can only concatenate str (not "tuple") to str

I use python version 3.7

@Eleazarus
Copy link

Eleazarus commented Sep 10, 2019

Hello,

Same error on Python 2.7.5, with the last version 0.4.0 (GLPI 9.4.3). Is this still maintained?

@jsalatiel
Copy link

Same problem here with python 2.7.15 with the last version 0.4.0 .

@KongNan
Copy link

KongNan commented Oct 18, 2019

3.7, same error.

@polkaa
Copy link

polkaa commented Nov 27, 2019

Mistake is in the utiliszation of GLPI constructor :

glpi = GLPI(url, token, (user, password))

(README)
while the constructor has the following signature :

def __init__(self, url, app_token, auth_token,
                 item_map=None):

(glpi/glpi.py)

GLPI constructor does not take a tuple of user and password as argument but an authentification token.

@manubuhay
Copy link

Mistake is in the utiliszation of GLPI constructor :

glpi = GLPI(url, token, (user, password))

(README) while the constructor has the following signature :

def __init__(self, url, app_token, auth_token,
                 item_map=None):

(glpi/glpi.py)

GLPI constructor does not take a tuple of user and password as argument but an authentification token.

Thank you, all the while I thought my code was the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants