@@ -6,11 +6,11 @@ class Feed(object):
66 def __init__ (self , client , feed_id , token ):
77 '''
88 Initializes the Feed class
9-
9+
1010 :param client: the api client
1111 :param feed_id: the feed id (string)
12-
13-
12+
13+
1414 '''
1515 self .client = client
1616 self .feed_id = feed_id
@@ -30,11 +30,11 @@ def add_activity(self, activity_data):
3030 '''
3131 Adds an activity to the feed, this will also trigger an update
3232 to all the feeds which follow this feed
33-
33+
3434 :param activity_data: a dict with the activity data
35-
35+
3636 **Example**::
37-
37+
3838 activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1}
3939 activity_id = feed.add_activity(activity_data)
4040 '''
@@ -44,15 +44,15 @@ def add_activity(self, activity_data):
4444 result = self .client .post (
4545 self .feed_url , data = activity_data , authorization = self .authorization )
4646 return result
47-
47+
4848 def add_activities (self , activity_list ):
4949 '''
5050 Adds a list of activities to the feed
51-
51+
5252 :param activity_list: a list with the activity data dicts
53-
53+
5454 **Example**::
55-
55+
5656 activity_data = [
5757 {'actor': 1, 'verb': 'tweet', 'object': 1},
5858 {'actor': 2, 'verb': 'watch', 'object': 2},
@@ -61,7 +61,8 @@ def add_activities(self, activity_list):
6161 '''
6262 for activity_data in activity_list :
6363 if activity_data .get ('to' ):
64- activity_data ['to' ] = self .add_to_signature (activity_data ['to' ])
64+ activity_data ['to' ] = self .add_to_signature (
65+ activity_data ['to' ])
6566
6667 data = dict (activities = activity_list )
6768 result = self .client .post (
@@ -71,7 +72,7 @@ def add_activities(self, activity_list):
7172 def remove_activity (self , activity_id = None , foreign_id = None ):
7273 '''
7374 Removes an activity from the feed
74-
75+
7576 :param activity_id: the activity id to remove from this feed
7677 (note this will also remove the activity from feeds which follow this feed)
7778 :param foreign_id: the foreign id you provided when adding the activity
@@ -83,13 +84,14 @@ def remove_activity(self, activity_id=None, foreign_id=None):
8384 params = dict ()
8485 if foreign_id is not None :
8586 params ['foreign_id' ] = '1'
86- result = self .client .delete (url , authorization = self .authorization , params = params )
87+ result = self .client .delete (
88+ url , authorization = self .authorization , params = params )
8789 return result
8890
8991 def follow (self , target_feed ):
9092 '''
9193 Follows the given feed
92-
94+
9395 :param target_feed: the feed to follow, ie flat:3
9496 '''
9597 url = self .feed_url + 'follows/'
@@ -101,12 +103,6 @@ def follow(self, target_feed):
101103 url , data = data , authorization = self .authorization )
102104 return response
103105
104- def parse_follow_data (self , response ):
105- return {
106- 'count' : response ['count' ],
107- 'results' : response ['results' ]
108- }
109-
110106 def followers (self , offset = 0 , limit = 25 ):
111107 params = {
112108 'limit' : limit ,
@@ -115,7 +111,7 @@ def followers(self, offset=0, limit=25):
115111 url = self .feed_url + 'followers/'
116112 response = self .client .get (
117113 url , params = params , authorization = self .authorization )
118- return self . parse_follow_data ( response )
114+ return response
119115
120116 def following (self , offset = 0 , limit = 25 , feeds = None ):
121117 feeds = feeds is not None and ',' .join (feeds ) or ''
@@ -127,7 +123,7 @@ def following(self, offset=0, limit=25, feeds=None):
127123 url = self .feed_url + 'follows/'
128124 response = self .client .get (
129125 url , params = params , authorization = self .authorization )
130- return self . parse_follow_data ( response )
126+ return response
131127
132128 def unfollow (self , target_feed ):
133129 '''
@@ -141,12 +137,12 @@ def unfollow(self, target_feed):
141137 def get (self , ** params ):
142138 '''
143139 Get the activities in this feed
144-
140+
145141 **Example**::
146-
142+
147143 # fast pagination using id filtering
148144 feed.get(limit=10, id_lte=100292310)
149-
145+
150146 # slow pagination using offset
151147 feed.get(limit=10, offset=10)
152148 '''
0 commit comments