From f94ce57804ea555fab8707e10a8a08d599db1e60 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Wed, 12 Apr 2023 06:26:21 -0400 Subject: [PATCH] Add requirements --- src/api/search.py | 20 ++++++++++++++++++-- src/requirements.txt | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/api/search.py b/src/api/search.py index c38504d..2826b22 100644 --- a/src/api/search.py +++ b/src/api/search.py @@ -8,8 +8,8 @@ import logging api = Namespace('search', description='Search the OHLQ website') -@api.route('/') -@api.doc(description='Search the OHLQ website. This is equivilant to the search box on the home page.') +@api.route('/literal/') +@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): @api.doc('get') @api.response(200, 'Success') @@ -19,8 +19,24 @@ class Search(Resource): reply = performSearch(query) except Exception as e: abort(500, str(e)) + return reply +@api.route('/pretty/') +@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 @lru_cache(maxsize=32) diff --git a/src/requirements.txt b/src/requirements.txt index e69de29..a555afc 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -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