IndexError: tuple index out of range
wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
wsgi_app
ctx = self.request_context(environ)
error: t.Optional[BaseException] = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
full_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
self,
rv: t.Union[ft.ResponseReturnValue, HTTPException],
full_dispatch_request
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
dispatch_request
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
view_args: t.Dict[str, t.Any] = req.view_args # type: ignore[assignment]
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
def full_dispatch_request(self) -> Response:
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
_wrapper
def open_close_connection(self, _function):
@functools.wraps(_function)
def _wrapper(*args, **kwargs):
self.create_connection()
result = _function(*args, **kwargs)
self.close_connection()
return result
return _wrapper
def SQLQuery(self, query: str = '', params: tuple = ()):
product
menu=config['menu'])
@app.route('/product/<string:category>/<path:article>')
@SQL.open_close_connection
def product(category, article):
product = SQL.get_product(article)
products = SQL.get_products_by_uid(product['uid'])
for index, _product in enumerate(products):
amount = _product['amount']
products[index]: dict = json.loads(_product['params'])
get_product
self.SQLQuery(query = f"INSERT INTO `product` (`id`, `categoryId`, `name`, `article`, `uid`, `params`, `amount`, `activity`, `collection_id`, `weight`, `length`, `width`, `height`) VALUES {sql_str};",
params=tuple(sql_param))
def get_product(self, articul):
return self.SQLQuery(query = "SELECT * FROM `product` WHERE `article` LIKE %s AND `activity` LIKE '1' AND is_delete = 0",
params=(articul))[0]
def get_products_by_uid(self, uid):
return self.SQLQuery(query = "SELECT * FROM `product` WHERE `uid` = %s AND is_delete = 0",
params=(uid))
IndexError: tuple index out of range
This is the Copy/Paste friendly version of the traceback.
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.