aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2019-09-10 23:54:40 -0300
committerLibravatar Renard 2019-09-10 23:54:40 -0300
commit988f1e5f0f3b1f194c67de6dafd1b5feb23da3f3 (patch)
tree8d99af11c671fdec22462ce7c3f47b77b8b7d1c0
parent4e99567cbfadf55115a189894eaf382641b5b7da (diff)
downloadweabot-988f1e5f0f3b1f194c67de6dafd1b5feb23da3f3.tar.gz
weabot-988f1e5f0f3b1f194c67de6dafd1b5feb23da3f3.tar.xz
weabot-988f1e5f0f3b1f194c67de6dafd1b5feb23da3f3.zip
API: newThreads
-rw-r--r--cgi/api.py14
1 files changed, 14 insertions, 0 deletions
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"