aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/api/feed.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-14 00:02:47 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-14 00:02:47 +0200
commitb4b175e0a8bb3844c1c6f846c1b4eb1970520864 (patch)
tree1cc59a636e2c4dffdb86bc2daaeee6f14a28eefa /src/web/views/api/feed.py
parentupdated some JS dependencies. (diff)
downloadnewspipe-b4b175e0a8bb3844c1c6f846c1b4eb1970520864.tar.gz
newspipe-b4b175e0a8bb3844c1c6f846c1b4eb1970520864.tar.bz2
newspipe-b4b175e0a8bb3844c1c6f846c1b4eb1970520864.zip
testing a new API
Diffstat (limited to 'src/web/views/api/feed.py')
-rw-r--r--src/web/views/api/feed.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/web/views/api/feed.py b/src/web/views/api/feed.py
deleted file mode 100644
index 774bff5f..00000000
--- a/src/web/views/api/feed.py
+++ /dev/null
@@ -1,49 +0,0 @@
-from conf import API_ROOT
-from flask import current_app
-from flask.ext.restful import Api
-
-from web.views.common import api_permission
-from web.controllers.feed import (FeedController,
- DEFAULT_MAX_ERROR,
- DEFAULT_LIMIT,
- DEFAULT_REFRESH_RATE)
-
-from web.views.api.common import PyAggAbstractResource, \
- PyAggResourceNew, \
- PyAggResourceExisting, \
- PyAggResourceMulti
-
-
-class FeedNewAPI(PyAggResourceNew):
- controller_cls = FeedController
-
-
-class FeedAPI(PyAggResourceExisting):
- controller_cls = FeedController
-
-
-class FeedsAPI(PyAggResourceMulti):
- controller_cls = FeedController
-
-
-class FetchableFeedAPI(PyAggAbstractResource):
- controller_cls = FeedController
- attrs = {'max_error': {'type': int, 'default': DEFAULT_MAX_ERROR},
- 'limit': {'type': int, 'default': DEFAULT_LIMIT},
- 'refresh_rate': {'type': int, 'default': DEFAULT_REFRESH_RATE}}
-
- @api_permission.require(http_exception=403)
- def get(self):
- args = self.reqparse_args(right='read', allow_empty=True)
- result = [feed for feed
- in self.controller.list_fetchable(**args)]
- return result or None, 200 if result else 204
-
-
-api = Api(current_app, prefix=API_ROOT)
-
-api.add_resource(FeedNewAPI, '/feed', endpoint='feed_new.json')
-api.add_resource(FeedAPI, '/feed/<int:obj_id>', endpoint='feed.json')
-api.add_resource(FeedsAPI, '/feeds', endpoint='feeds.json')
-api.add_resource(FetchableFeedAPI, '/feeds/fetchable',
- endpoint='fetchable_feed.json')
bgstack15