Files
python-zaqarclient/zaqarclient/transport/request.py
Eva Balycheva 640f56a1db Fix client not working on Python 3
Currently the client is not working at all on Python 3 when it uses
Keystone authentication, and no project id is specified by user.

It is because in this case the client prepares a request with
'X-Project-Id' header assigned to {} (empty dictionary) value. The
Python 3 standard HTTP library expects all passed headers to be strings
and fails when one of the headers is dictionary:

  File "/usr/lib/python3.4/http/client.py", line 1069, in putheader
    value = b'\r\n\t'.join(values)
TypeError: sequence item 0: expected bytes, bytearray, or an object with
the buffer interface, dict found

This patch solves the problem by making the client not add
'X-Project-Id' to request at all in this case.

Change-Id: I7296b08d273b7173a9f6deb0ae9fb6ff929366db
Closes-Bug: 1525973
2016-01-25 07:24:25 +03:00

4.0 KiB