Skip to content

Commit 1b40c9d

Browse files
HTTP responses (#10)
* Fixing HTTP responses on body (#9) Co-authored-by: Fabiana Garcia <fabiana.garcia@fit-tecnologia.org.br> Co-authored-by: Fabiana Garcia <fabiana.garcia@fit-tecnologia.org.br>
1 parent 546b8d5 commit 1b40c9d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

api_routes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from flask_cors.decorator import cross_origin
21
import werkzeug
32

43
from werkzeug.utils import cached_property
@@ -18,7 +17,7 @@
1817
class Search(Resource):
1918
@search_ns.doc(responses={
2019
200: 'OK',
21-
400: 'BAD REQUEST',
20+
404: 'NO RESULT FOUND',
2221
500: 'INTERNAL SERVER ERROR'
2322
})
2423
@search_ns.doc(description='Searches for keyword on Twitter through stream listener')
@@ -28,9 +27,9 @@ def post(self):
2827
try:
2928
return SearchResultParser().search_result_parser(keyword), 200
3029
except errors.EmptyDataError:
31-
return 404
30+
return 'NO RESULT FOUND', 404
3231
except:
33-
return 500
32+
return 'INTERNAL SERVER ERROR', 500
3433

3534
@search_ns.route('/trending-topics')
3635
class SearchTrendingTopics(Resource):
@@ -44,4 +43,4 @@ def get(self):
4443
try:
4544
return SearchResultParser().trending_topics_parser(23424768), 200
4645
except:
47-
return 500
46+
return 'INTERNAL SERVER ERROR', 500

0 commit comments

Comments
 (0)