GetStream / stream-python

Python Client - Build Activity Feeds & Streams with GetStream.io
https://getstream.io
BSD 3-Clause "New" or "Revised" License
141 stars 41 forks source link

can only concatenate str (not "bytes") to str #132

Closed SidAtNSIO closed 2 years ago

SidAtNSIO commented 2 years ago

Problem explanation

"can only concatenate str (not "bytes") to str" this error occurs when we are assigning a user to feed group

Steps to reproduce

client.feed('user', str(some_id))

Environment info

Operating System: Ubuntu 20.04 Python version: Python 3.8.10 Library version: 5.1.0

Error traceback (if applicable)

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/path/to/stream_python-5.1.0-py3.8.egg/stream/client.py", line 118, in feed
    return Feed(self, feed_slug, user_id, token)
  File "/path/to/stream_python-5.1.0-py3.8.egg/stream/feed.py", line 29, in __init__
    self.signature = self.feed_together + " " + self.token
TypeError: can only concatenate str (not "bytes") to str

Code snippet that causes the problem

client.feed('user', str(some_id))
ferhatelmas commented 2 years ago

What is the version of pyjwt in your project?

cc @peterdeme

SidAtNSIO commented 2 years ago

pyjwt = 1.7.1

peterdeme commented 2 years ago

So it seems like the bytes vs str behavior of PyJWT has changed here. If I see it correctly that's version 2.0.

So @SidAtNSIO, you're not supposed to use anything less than 2.0.

As for ourselves, we bumped it in this PR. So if you still want to use a lower PyJWT version, you should use stream-python 5.0.0.

But I'd rather advise you to bump PyJWT is your owner project.

edit: just saw your PR. that could work too. 🙂

ferhatelmas commented 2 years ago

fixed in https://github.com/GetStream/stream-python/releases/tag/v5.1.1