@@ -21,12 +21,12 @@ class Api:
2121 """
2222
2323 def __init__ (
24- self ,
25- email = None ,
26- password = None ,
27- base_url = None ,
28- publication_url = None ,
29- debug = False ,
24+ self ,
25+ email = None ,
26+ password = None ,
27+ base_url = None ,
28+ publication_url = None ,
29+ debug = False ,
3030 ):
3131 """
3232
@@ -94,8 +94,10 @@ def _handle_response(response: requests.Response):
9494
9595 def get_publication_users (self ):
9696 """
97+ Get list of users.
98+
99+ Returns:
97100
98- :return:
99101 """
100102 response = self ._session .get (f"{ self .publication_url } /publication/users" )
101103
@@ -104,20 +106,39 @@ def get_publication_users(self):
104106 def get_posts (self ) -> dict :
105107 """
106108
107- :return:
109+ Returns:
110+
108111 """
109112 response = self ._session .get (f"{ self .base_url } /reader/posts" )
110113
111114 return Api ._handle_response (response = response )
112115
113116 def get_drafts (self , filter = None , offset = None , limit = None ):
117+ """
118+
119+ Args:
120+ filter:
121+ offset:
122+ limit:
123+
124+ Returns:
125+
126+ """
114127 response = self ._session .get (
115128 f"{ self .publication_url } /drafts" ,
116129 params = {"filter" : filter , "offset" : offset , "limit" : limit },
117130 )
118131 return Api ._handle_response (response = response )
119132
120133 def delete_draft (self , draft_id ):
134+ """
135+
136+ Args:
137+ draft_id:
138+
139+ Returns:
140+
141+ """
121142 response = self ._session .delete (f"{ self .publication_url } /drafts/{ draft_id } " )
122143 return Api ._handle_response (response = response )
123144
@@ -134,12 +155,12 @@ def post_draft(self, body) -> dict:
134155 return Api ._handle_response (response = response )
135156
136157 def put_draft (
137- self ,
138- draft ,
139- title = None ,
140- subtitle = None ,
141- body = None ,
142- cover_image = None ,
158+ self ,
159+ draft ,
160+ title = None ,
161+ subtitle = None ,
162+ body = None ,
163+ cover_image = None ,
143164 ) -> dict :
144165 """
145166
@@ -181,7 +202,7 @@ def prepublish_draft(self, draft) -> dict:
181202 return Api ._handle_response (response = response )
182203
183204 def publish_draft (
184- self , draft , send : bool = True , share_automatically : bool = False
205+ self , draft , send : bool = True , share_automatically : bool = False
185206 ) -> dict :
186207 """
187208
@@ -262,6 +283,16 @@ def get_categories(self):
262283 return Api ._handle_response (response = response )
263284
264285 def get_category (self , category_id , category_type , page ):
286+ """
287+
288+ Args:
289+ category_id:
290+ category_type:
291+ page:
292+
293+ Returns:
294+
295+ """
265296 response = self ._session .get (
266297 f"{ self .base_url } /category/public/{ category_id } /{ category_type } " ,
267298 params = {"page" : page },
@@ -289,7 +320,7 @@ def get_single_category(self, category_id, category_type, page=None, limit=None)
289320 page_output = self .get_category (category_id , category_type , page )
290321 publications .extend (page_output .get ("publications" , []))
291322 if (
292- limit is not None and limit <= len (publications )
323+ limit is not None and limit <= len (publications )
293324 ) or not page_output .get ("more" , False ):
294325 publications = publications [:limit ]
295326 break
@@ -301,6 +332,11 @@ def get_single_category(self, category_id, category_type, page=None, limit=None)
301332 return output
302333
303334 def delete_all_drafts (self ):
335+ """
336+
337+ Returns:
338+
339+ """
304340 response = None
305341 while True :
306342 drafts = self .get_drafts (filter = "draft" , limit = 10 , offset = 0 )
0 commit comments