-
Notifications
You must be signed in to change notification settings - Fork 27
Issue with quickstart tutorial python3.4 str no attribute decode #49
Description
With the code that I can find in the quickstart tutorial I have this error:
_Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.4/multiprocessing/process.py", line 254, in _bootstrap
self.run()
File "/usr/lib/python3.4/multiprocessing/process.py", line 93, in run
self._target(_self._args, *_self._kwargs)
File "/usr/local/lib/python3.4/dist-packages/datasift/client.py", line 237, in stream
options = ssl.optionsForClientTLS(hostname=WEBSOCKET_HOST.decode("utf-8"))
AttributeError: 'str' object has no attribute 'decode'
If I change in the tutorial's code
client = datasift.Client('DATASIFT_USERNAME', 'DATASIFT_API_KEY')
with
client = datasift.Client(b'DATASIFT_USERNAME', b'DATASIFT_API_KEY')
I have this error:
Traceback (most recent call last):
File "tutorial_datasift.py", line 9, in
fltr = client.compile(csdl)
File "/usr/local/lib/python3.4/dist-packages/datasift/client.py", line 256, in compile
return self.request.post('compile', data=dict(csdl=csdl))
File "/usr/local/lib/python3.4/dist-packages/datasift/request.py", line 46, in post
return self.build_response(self('post', path, params=params, headers=headers, data=data), path=path)
File "/usr/local/lib/python3.4/dist-packages/datasift/request.py", line 86, in build_response
raise AuthException(data)
datasift.exceptions.AuthException: {'error': 'Authorization failed'}
If I change in client.py line 237
options = ssl.optionsForClientTLS(hostname=WEBSOCKET_HOST.decode("utf-8"))
with
options = ssl.optionsForClientTLS(hostname=WEBSOCKET_HOST)
it seems run.