@@ -105,6 +105,40 @@ def iter_all_posts(self, limit=None):
105105 for cid in cids :
106106 yield self .get_post (cid )
107107
108+ def create_followup (self , post , content , anonymous = False ):
109+ """Create a follow-up on a post `post`.
110+
111+ It seems like if the post has `<p>` tags, then it's treated as HTML,
112+ but is treated as text otherwise. You'll want to provide `content`
113+ accordingly.
114+
115+ :type post: dict|str|int
116+ :param post: Either the post dict returned by another API method, or
117+ the `cid` field of that post.
118+ :type subject: str
119+ :param content: The content of the followup.
120+ :type anonymous: bool
121+ :param anonymous: Whether or not to post anonymously.
122+ :rtype: dict
123+ :returns: Dictionary with information about the created follow-up.
124+ """
125+ try :
126+ cid = post ["id" ]
127+ except KeyError :
128+ cid = post
129+
130+ params = {
131+ "cid" : cid ,
132+ "type" : "followup" ,
133+
134+ # For followups, the content is actually put into the subject.
135+ "subject" : content ,
136+ "content" : "" ,
137+
138+ "anonymous" : "yes" if anonymous else "no" ,
139+ }
140+ return self ._rpc .content_create (params )
141+
108142 #########
109143 # Users #
110144 #########
@@ -113,8 +147,8 @@ def get_users(self, user_ids):
113147 """Get a listing of data for specific users ``user_ids`` in
114148 this network
115149
116- :type user_ids: list of str
117- :param user_ids: a list of user ids. These are the same
150+ :type user_ids: list
151+ :param user_ids: A list of user ids (strings) . These are the same
118152 ids that are returned by get_all_users.
119153 :returns: Python object containing returned data, a list
120154 of dicts containing user data.
0 commit comments