@@ -32,6 +32,7 @@ class InoreaderClient(object):
3232 SUBSCRIPTION_LIST_PATH = 'subscription/list'
3333 STREAM_CONTENTS_PATH = 'stream/contents/'
3434 EDIT_TAG_PATH = 'edit-tag'
35+ EDIT_SUBSCRIPTION_PATH = 'subscription/edit'
3536
3637 # tags
3738 GENERAL_TAG_TEMPLATE = 'user/-/label/{}'
@@ -283,3 +284,27 @@ def remove_liked(self, articles):
283284
284285 def broadcast (self , articles ):
285286 self .add_general_label (articles , self .BROADCAST_TAG )
287+
288+ def edit_subscription (self , stream_id , action , title = None , add_folder = None , remove_folder = None ):
289+ self .check_token ()
290+ url = urljoin (BASE_URL , self .EDIT_SUBSCRIPTION_PATH )
291+ # https://us.inoreader.com/developers/edit-subscription
292+ # The documentation looks a bit outdated, `follow`/`unfollow` don't work
293+ action = {'follow' : 'subscribe' , 'unfollow' : 'unsubscribe' }.get (action ) or action
294+ params = {'ac' : action , 's' : stream_id }
295+ if title :
296+ params ['t' ] = title
297+
298+ if add_folder :
299+ params ['a' ] = add_folder
300+
301+ if remove_folder :
302+ params ['r' ] = remove_folder
303+
304+ r = self .session .post (url , params = params , proxies = self .proxies )
305+ response = self .parse_response (
306+ r ,
307+ # self.session.post(url, params=params, proxies=self.proxies),
308+ json_data = False
309+ )
310+ return response
0 commit comments