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

TypeError: Can't convert 'bytes' object to str implicitly #11

Open
jukebox opened this issue Jun 19, 2017 · 4 comments
Open

TypeError: Can't convert 'bytes' object to str implicitly #11

jukebox opened this issue Jun 19, 2017 · 4 comments

Comments

@jukebox
Copy link

jukebox commented Jun 19, 2017

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 221, in set_session_token
    err = _glpi_html_parser(r.content)
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 100, in _glpi_html_parser
    html_parser = GlpiHTMLParser(content)
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 76, in __init__
    self.feed(content)
  File "/usr/lib/python3.5/html/parser.py", line 110, in feed
    self.rawdata = self.rawdata + data
TypeError: Can't convert 'bytes' object to str implicitly

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "testgplisdk.py", line 4, in <module>
    g.get_all('ticket')
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 517, in get_all
    self.init_api()
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 481, in init_api
    self.api_session = self.api_rest.get_session_token()
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 236, in get_session_token
    self.set_session_token()
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 224, in set_session_token
    err = _glpi_html_parser(r.content)
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 100, in _glpi_html_parser
    html_parser = GlpiHTMLParser(content)
  File "/usr/local/lib/python3.5/dist-packages/glpi/glpi.py", line 76, in __init__
    self.feed(content)
  File "/usr/lib/python3.5/html/parser.py", line 110, in feed
    self.rawdata = self.rawdata + data
TypeError: Can't convert 'bytes' object to str implicitly

`

@NikiN2
Copy link

NikiN2 commented Oct 9, 2017

such an error was when the nginx was configured incorrectly, after adjusting according to the example from the documentation it became ok

@poikilotherm
Copy link

I'm running into the exact same issue whenever I receive an error response from GLPI.

@NikiN2: Could you describe a bit more in detail, what caused your problem and made it go away?

Thanks!

@NikiN2
Copy link

NikiN2 commented Nov 2, 2017

@poikilotherm I used the config from the documentation and the bugs were gone
https://github.com/glpi-project/glpi/blob/master/apirest.md#servers-configuration

@poikilotherm
Copy link

Thanks for the link :-) Actually, I'm not using URL rewriting within my config, just plain apirest.php.

@mtulio are you sure this is no bug within the SDK while handling the HTML response?

@NikiN2 can you reproduce the error without the rewrite? I was getting the error while I had a wrong App-Token in use...

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

3 participants