Update app.py
Browse files
app.py
CHANGED
|
@@ -541,6 +541,18 @@ def updateItemDisplay(seshid, budget=False, pallete_change=False):
|
|
| 541 |
#print('wrote For Store Processing: ', store)
|
| 542 |
#print('completed writing For Store Processing')
|
| 543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
|
| 545 |
sesh.updated_display = realised_display
|
| 546 |
summarisePerStore(seshid)
|
|
@@ -1107,7 +1119,7 @@ def loadColorAndCharacter(text, seshid):
|
|
| 1107 |
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in sesh.product_pd_counts]
|
| 1108 |
sesh.responses = asyncio.run(main(urls))
|
| 1109 |
|
| 1110 |
-
#gen_uid = str(time.time())
|
| 1111 |
item_locator_data = {data[1]: sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][data[1]][data[0]] for data in sesh.display_items_[sesh.current_img_signature] if data[1] not in ['Palette', 'Living Room', 'Bedroom']}
|
| 1112 |
print('item_locator_data: ', item_locator_data, '\n/*/*', [item_locator_data[product_pd_count[0]] for i,product_pd_count in enumerate(sesh.product_pd_counts)])
|
| 1113 |
responses = [r.decode('ISO-8859-1') if type(r) != type(None) else r for r in sesh.responses]
|
|
@@ -1117,7 +1129,7 @@ def loadColorAndCharacter(text, seshid):
|
|
| 1117 |
if tuple(idxs) not in sesh.locator_genid: sesh.locator_genid[tuple(idxs)] = gen_uid = str(time.time())
|
| 1118 |
json_data = [json.dumps({'room_type': sesh.room_type, 'item_locator_data': item_locator_data[product_pd_count[0]], 'gen_uid': sesh.locator_genid[tuple(item_locator_data[product_pd_count[0]])], 'response':responses[i], 'item': product_pd_count[0]}) for i,product_pd_count in enumerate(sesh.product_pd_counts) if product_pd_count[0] not in ['Palette', 'Living Room', 'Bedroom']]
|
| 1119 |
responses = asyncio.run(main_post(urls, headers, json_data, timeout=3))
|
| 1120 |
-
print('dump_text_gen: ', responses)
|
| 1121 |
|
| 1122 |
dummy = dummy_
|
| 1123 |
|
|
|
|
| 541 |
#print('wrote For Store Processing: ', store)
|
| 542 |
#print('completed writing For Store Processing')
|
| 543 |
|
| 544 |
+
#gen_uid = str(time.time())
|
| 545 |
+
item_locator_data = {data[1]: sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][data[1]][data[0]] for data in sesh.display_items_[sesh.current_img_signature] if data[1] not in ['Palette', 'Living Room', 'Bedroom']}
|
| 546 |
+
print('item_locator_data: ', item_locator_data, '\n/*/*', [item_locator_data[product_pd_count[0]] for i,product_pd_count in enumerate(sesh.product_pd_counts)])
|
| 547 |
+
responses = [r.decode('ISO-8859-1') if type(r) != type(None) else r for r in sesh.responses]
|
| 548 |
+
urls = ['https://dreamdemo.pythonanywhere.com/dump_text_gen' for _ in range(len(sesh.product_pd_counts))]
|
| 549 |
+
headers = [{'Content-type': 'application/json', 'Accept': 'text/plain'} for i,_ in enumerate(urls)]
|
| 550 |
+
for item,idxs in item_locator_data.items():
|
| 551 |
+
if tuple(idxs) not in sesh.locator_genid: sesh.locator_genid[tuple(idxs)] = gen_uid = str(time.time())
|
| 552 |
+
json_data = [json.dumps({'room_type': sesh.room_type, 'item_locator_data': item_locator_data[product_pd_count[0]], 'gen_uid': sesh.locator_genid[tuple(item_locator_data[product_pd_count[0]])], 'response':responses[i], 'item': product_pd_count[0]}) for i,product_pd_count in enumerate(sesh.product_pd_counts) if product_pd_count[0] not in ['Palette', 'Living Room', 'Bedroom']]
|
| 553 |
+
responses = asyncio.run(main_post(urls, headers, json_data, timeout=.1))
|
| 554 |
+
print('dump_text_gen: ', responses)
|
| 555 |
+
|
| 556 |
|
| 557 |
sesh.updated_display = realised_display
|
| 558 |
summarisePerStore(seshid)
|
|
|
|
| 1119 |
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in sesh.product_pd_counts]
|
| 1120 |
sesh.responses = asyncio.run(main(urls))
|
| 1121 |
|
| 1122 |
+
"""#gen_uid = str(time.time())
|
| 1123 |
item_locator_data = {data[1]: sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][data[1]][data[0]] for data in sesh.display_items_[sesh.current_img_signature] if data[1] not in ['Palette', 'Living Room', 'Bedroom']}
|
| 1124 |
print('item_locator_data: ', item_locator_data, '\n/*/*', [item_locator_data[product_pd_count[0]] for i,product_pd_count in enumerate(sesh.product_pd_counts)])
|
| 1125 |
responses = [r.decode('ISO-8859-1') if type(r) != type(None) else r for r in sesh.responses]
|
|
|
|
| 1129 |
if tuple(idxs) not in sesh.locator_genid: sesh.locator_genid[tuple(idxs)] = gen_uid = str(time.time())
|
| 1130 |
json_data = [json.dumps({'room_type': sesh.room_type, 'item_locator_data': item_locator_data[product_pd_count[0]], 'gen_uid': sesh.locator_genid[tuple(item_locator_data[product_pd_count[0]])], 'response':responses[i], 'item': product_pd_count[0]}) for i,product_pd_count in enumerate(sesh.product_pd_counts) if product_pd_count[0] not in ['Palette', 'Living Room', 'Bedroom']]
|
| 1131 |
responses = asyncio.run(main_post(urls, headers, json_data, timeout=3))
|
| 1132 |
+
print('dump_text_gen: ', responses)"""
|
| 1133 |
|
| 1134 |
dummy = dummy_
|
| 1135 |
|