aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/rest.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-06-23 08:38:17 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-06-23 08:38:17 +0200
commite2cc76ba716c54bf6d318c2a913407443bbf42e0 (patch)
tree5a2343ced8e726490f1951cc7705e45c9a320434 /pyaggr3g470r/rest.py
parentThe API has been updated. (diff)
downloadnewspipe-e2cc76ba716c54bf6d318c2a913407443bbf42e0.tar.gz
newspipe-e2cc76ba716c54bf6d318c2a913407443bbf42e0.tar.bz2
newspipe-e2cc76ba716c54bf6d318c2a913407443bbf42e0.zip
The JSON service now returns HTTPS status code with messages to explain the problem.
Diffstat (limited to 'pyaggr3g470r/rest.py')
-rw-r--r--pyaggr3g470r/rest.py45
1 files changed, 33 insertions, 12 deletions
diff --git a/pyaggr3g470r/rest.py b/pyaggr3g470r/rest.py
index 4b67a419..4c95e8bf 100644
--- a/pyaggr3g470r/rest.py
+++ b/pyaggr3g470r/rest.py
@@ -109,13 +109,28 @@ class ArticleListAPI(Resource):
)
def post(self):
- pass
+ """
+ POST method - no sense here.
+ """
+ response = jsonify({'code': 501, 'message': 'POST method not implemented for Article objects.'})
+ response.status_code = 501
+ return response
def put(self):
- pass
+ """
+ PUT method - no sense here.
+ """
+ response = jsonify({'code': 501, 'message': 'PUT method not implemented for Article objects.'})
+ response.status_code = 501
+ return response
def delete(self):
- pass
+ """
+ DELETE method - no sense here.
+ """
+ response = jsonify({'code': 501, 'message': 'DELETE method not implemented for Article objects.'})
+ response.status_code = 501
+ return response
class ArticleAPI(Resource):
"""
@@ -154,23 +169,29 @@ class ArticleAPI(Resource):
for article in result]
)
- def post(self, id):
+ def post(self):
"""
- Update an article.
+ POST method - no sense here.
"""
- pass
+ response = jsonify({'code': 501, 'message': 'POST method not implemented for Article objects.'})
+ response.status_code = 501
+ return response
- def put(self, id):
+ def put(self):
"""
- Create an article.
+ PUT method - no sense here.
"""
- pass
+ response = jsonify({'code': 501, 'message': 'PUT method not implemented for Article objects.'})
+ response.status_code = 501
+ return response
- def delete(self, id):
+ def delete(self):
"""
- Delete an article.
+ DELETE method - no sense here.
"""
- pass
+ response = jsonify({'code': 501, 'message': 'DELETE method not implemented for Article objects.'})
+ response.status_code = 501
+ return response
api.add_resource(ArticleListAPI, '/api/v1.0/articles', endpoint = 'articles.json')
api.add_resource(ArticleAPI, '/api/v1.0/articles/<int:id>', endpoint = 'article.json')
bgstack15