Introduction

Sunspear is a python library which provides an API to store and manage activity stream items.

What it is

Sunspear is a library which allows you to add feeds and activity streams to your applications. It serializes these activities and feed items as described in the JSON Activity Stream 1.0 specifications.

The specifications look scary, dull and boring (and they are), but essentially, an activity for:

``John Doe`` added ``Jane Doe`` to the group ``Party Planning``

boils down to:

{
    "actor": {
        "objectType": "user",
        "displayName": "John Doe",
        "id": "user:1234", # Totally optional, it will be generated for you if you don't provide one.
        "title": "Manager",
        "foo": "bar"
    },
    "object": {
        "objectType": "user",
        "displayName": "Jane Doe",
        "title": "Devloper",
        "foo": "baz"
    },
    "target": {
        "objectType": "group",
        "displayName": "Party Planning"
    },
    "bar": "bee",
    "verb": "added"
}

The main takeaway points are:

  • An activity is composed of objects.
  • An activity must define an actor, verb and object.
  • An object must define an objectType and a displayName
  • objects and activities may contain arbitrary attributes.

Note

For more info, see the specifications for activity and object.

Sunspear also implements parts of some extensions to the specificiations. More specifically, Audience Targeting and Responses.

What it isn’t

Sunspear strictly deals with storage and retrival of JSON activity stream items. It does not include all adquate indexes that allow you to build a fully fledged feed system.

For indexing, you’ll probably want to use something like Sandsnake, a sorted index backed by redis.