Add requirements

This commit is contained in:
Tyler Perkins 2023-04-12 06:26:21 -04:00
parent c3c7ff61e9
commit f94ce57804
2 changed files with 37 additions and 2 deletions

View File

@ -8,8 +8,8 @@ import logging
api = Namespace('search', api = Namespace('search',
description='Search the OHLQ website') description='Search the OHLQ website')
@api.route('/<string:query>') @api.route('/literal/<string:query>')
@api.doc(description='Search the OHLQ website. This is equivilant to the search box on the home page.') @api.doc(description='Search the OHLQ website. This is equivilant to the search box on the home page, and returns the exact same data structure.')
class Search(Resource): class Search(Resource):
@api.doc('get') @api.doc('get')
@api.response(200, 'Success') @api.response(200, 'Success')
@ -19,8 +19,24 @@ class Search(Resource):
reply = performSearch(query) reply = performSearch(query)
except Exception as e: except Exception as e:
abort(500, str(e)) abort(500, str(e))
return reply return reply
@api.route('/pretty/<string:query>')
@api.doc(description='Search the OHLQ website. This will return a cleaner version of the data, with relevant SKUs extracted from the URLs')
class SearchParse(Resource):
@api.doc('get')
@api.response(200, 'Success')
@api.response(500, 'Failure to retrieve data')
def get(self, query):
try:
reply = performSearch(query)
except Exception as e:
abort(500, str(e))
abort(500, "TODO - implement this")
return reply
# We define the caching mechanism for web requests # We define the caching mechanism for web requests
@lru_cache(maxsize=32) @lru_cache(maxsize=32)

View File

@ -0,0 +1,19 @@
aniso8601==9.0.1
attrs==22.2.0
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
envyaml==1.10.211231
Flask==2.2.3
flask-restx==1.1.0
idna==3.4
itsdangerous==2.1.2
Jinja2==3.1.2
jsonschema==4.17.3
MarkupSafe==2.1.2
pyrsistent==0.19.3
pytz==2023.3
PyYAML==6.0
requests==2.28.2
urllib3==1.26.15
Werkzeug==2.2.3