Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -250,10 +250,15 @@ async def generate_product_count_prediction(b_id: int):
|
|
250 |
|
251 |
@app.post("/get_product_count_prediction_from_DB")
|
252 |
async def get_product_count_prediction_from_DB(b_id: int,page_number :int,page_size :int):
|
|
|
|
|
|
|
|
|
|
|
253 |
response_content = {
|
254 |
"status": "done",
|
255 |
"message": "data from DB",
|
256 |
-
"data":
|
257 |
"status_code":200
|
258 |
}
|
259 |
return response_content
|
@@ -276,8 +281,12 @@ async def get_product_count_prediction_from_DB(
|
|
276 |
search_sku: str = Query(None, description="The SKU of the product to search"),
|
277 |
product_name: str = Query(None, description="The name of the product to search")
|
278 |
):
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
-
related_products = find_related_products(sub_sku=search_sku, product_name=product_name,forecast_data = get_data(b_id,1,2,True))
|
281 |
response_content = {
|
282 |
"status": "done",
|
283 |
"message": "data from DB",
|
|
|
250 |
|
251 |
@app.post("/get_product_count_prediction_from_DB")
|
252 |
async def get_product_count_prediction_from_DB(b_id: int,page_number :int,page_size :int):
|
253 |
+
try:
|
254 |
+
data = get_data(b_id,page_number,page_size,False)
|
255 |
+
except Exception as e:
|
256 |
+
data = str(e)
|
257 |
+
print(str(e))
|
258 |
response_content = {
|
259 |
"status": "done",
|
260 |
"message": "data from DB",
|
261 |
+
"data": data,
|
262 |
"status_code":200
|
263 |
}
|
264 |
return response_content
|
|
|
281 |
search_sku: str = Query(None, description="The SKU of the product to search"),
|
282 |
product_name: str = Query(None, description="The name of the product to search")
|
283 |
):
|
284 |
+
try:
|
285 |
+
related_products = find_related_products(sub_sku=search_sku, product_name=product_name,forecast_data = get_data(b_id,1,2,True))
|
286 |
+
except Exception as e:
|
287 |
+
related_products = str(e)
|
288 |
+
print(str(e))
|
289 |
|
|
|
290 |
response_content = {
|
291 |
"status": "done",
|
292 |
"message": "data from DB",
|