Welcome to stream-python’s documentation!¶
Contents:
stream package¶
Submodules¶
stream.client module¶
stream.exceptions module¶
- exception stream.exceptions.ApiKeyException(error_message, status_code=None)[source]¶
Bases: stream.exceptions.StreamApiException
Raised when there is an issue with your Access Key
- code = 2¶
- status_code = 401¶
- exception stream.exceptions.CustomFieldException(error_message, status_code=None)[source]¶
Bases: stream.exceptions.StreamApiException
Raised when there are missing or misconfigured custom fields
- code = 5¶
- status_code = 400¶
- exception stream.exceptions.FeedConfigException(error_message, status_code=None)[source]¶
Bases: stream.exceptions.StreamApiException
Raised when there are missing or misconfigured custom fields
- code = 6¶
- status_code = 400¶
- exception stream.exceptions.InputException(error_message, status_code=None)[source]¶
Bases: stream.exceptions.StreamApiException
Raised when you send the wrong data to the API
- code = 4¶
- status_code = 400¶
- exception stream.exceptions.SignatureException(error_message, status_code=None)[source]¶
Bases: stream.exceptions.StreamApiException
Raised when there is an issue with the signature you provided
- code = 3¶
- status_code = 401¶
- exception stream.exceptions.SiteSuspendedException(error_message, status_code=None)[source]¶
Bases: stream.exceptions.StreamApiException
Raised when the site requesting the data is suspended
- code = 7¶
- status_code = 401¶
stream.feed module¶
- class stream.feed.Feed(client, feed_slug, user_id, token)[source]¶
Bases: object
- add_activities(activity_list)[source]¶
Adds a list of activities to the feed
Parameters: activity_list – a list with the activity data dicts Example:
activity_data = [ {'actor': 1, 'verb': 'tweet', 'object': 1}, {'actor': 2, 'verb': 'watch', 'object': 2}, ] result = feed.add_activities(activity_data)
- add_activity(activity_data)[source]¶
Adds an activity to the feed, this will also trigger an update to all the feeds which follow this feed
Parameters: activity_data – a dict with the activity data Example:
activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1} activity_id = feed.add_activity(activity_data)
- add_to_signature(recipients)[source]¶
Takes a list of recipients such as [‘user:1’, ‘user:2’] and turns it into a list with the tokens included [‘user:1 token’, ‘user:2 token’]
- follow(target_feed_slug, target_user_id)[source]¶
Follows the given feed
Parameters: - target_feed_slug – the slug of the target feed
- target_user_id – the user id
- get(**params)[source]¶
Get the activities in this feed
Example:
# fast pagination using id filtering feed.get(limit=10, id_lte=100292310) # slow pagination using offset feed.get(limit=10, offset=10)
- remove_activity(activity_id=None, foreign_id=None)[source]¶
Removes an activity from the feed
Parameters: activity_id – the activity id to remove from this feed (note this will also remove the activity from feeds which follow this feed) :param foreign_id: the foreign id you provided when adding the activity