Monday 31 May 2021

Create activities for an user with Stream-Framework

I'm trying to setup stream-framework the one here not the newer getstream. I've setup the Redis server and the environment properly, the issue I'm facing is in creating the activities for a user.

I've been trying to create activities, following the documentation to add an activity but it gives me an error message as follows:

...
  File "/Users/.../stream_framework/activity.py", line 110, in serialization_id
    if self.object_id >= 10 ** 10 or self.verb.id >= 10 ** 3:
AttributeError: 'int' object has no attribute 'id'

Here is the code

from stream_framework.activity import Activity
from stream_framework.feeds.redis import RedisFeed


class PinFeed(RedisFeed):
    key_format = 'feed:normal:%(user_id)s'

class UserPinFeed(PinFeed):
    key_format = 'feed:user:%(user_id)s'

feed = UserPinFeed(13)
print(feed)

activity = Activity(
    actor=13, # Thierry's user id
    verb=1, # The id associated with the Pin verb
    object=1, # The id of the newly created Pin object
)

feed.add(activity) # Error at this line

I think there is something missing in the documentation or maybe I'm doing something wrong. I'll be very grateful if anyone helps me get the stream framework working properly.



from Create activities for an user with Stream-Framework

No comments:

Post a Comment