From 988f1e5f0f3b1f194c67de6dafd1b5feb23da3f3 Mon Sep 17 00:00:00 2001 From: Renard Date: Tue, 10 Sep 2019 23:54:40 -0300 Subject: API: newThreads --- cgi/api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cgi/api.py b/cgi/api.py index ce1e467..19122d0 100644 --- a/cgi/api.py +++ b/cgi/api.py @@ -371,6 +371,20 @@ def api_process(self, path_split): values['post_url'] = post_url values['time_taken'] = ttaken + elif method == 'newThreads': + data_limit = formdata.get('limit') + limit = 30 + if data_limit: + try: + limit = int(data_limit) + except ValueError: + raise APIError, "Limit must be numeric" + + if limit > 30: + raise APIError, "Maximum limit is 30" + + threads = getNewThreads(limit) + values['threads'] = threads else: raise APIError, "Invalid method" -- cgit v1.2.1-18-gbd029