summaryrefslogtreecommitdiff
path: root/python/products-dict-v5.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/products-dict-v5.py')
-rw-r--r--python/products-dict-v5.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/python/products-dict-v5.py b/python/products-dict-v5.py
index 8d32586..a0a8965 100644
--- a/python/products-dict-v5.py
+++ b/python/products-dict-v5.py
@@ -9,6 +9,7 @@
import mysql.connector as mysql # mysql connector
import re # regex
import json # json
+import ijson # json
import os.path # ...
import sys
from urllib.request import urlopen
@@ -333,7 +334,7 @@ for it in synonymOriginals :
## get data from endpoint (url)
-url = "http://localhost/api/v1/productsSearch"
+url = "https://emarket-laravel-dlqjpfxz5q-oa.a.run.app/api/v1/productsSearch"
json_url = urlopen(url)
received = json.loads(json_url.read())
@@ -341,7 +342,7 @@ received = json.loads(json_url.read())
# print(data)
# sys.exit()
-
+print ('products loaded')
# --- Lists to fill
keywords_ = [] # all data
@@ -389,8 +390,7 @@ for rec in received['data'] :
description = rec['txt']
pid = ['id']
- fq = 1
-
+ fq = 1
# setup product
# ---
@@ -448,11 +448,11 @@ for it in keywords_ :
## OUTPUT final data to a json-format file
# //////////////////////////////////////////////////////////////////////////////
-with open("./keywords-v5.json", "w", encoding="utf-8") as outfile :
+with open("./results/keywords-v5.json", "w", encoding="utf-8") as outfile :
data = json.dump(keywords_, outfile, sort_keys=False, indent=3, ensure_ascii=False)
-with open("./minilist-v5.json", "w", encoding="utf-8") as outfile :
+with open("./results/minilist-v5.json", "w", encoding="utf-8") as outfile :
data = json.dump(minilist_, outfile, sort_keys=False, indent=3, ensure_ascii=False)
-with open("./products-v5.json", "w", encoding="utf-8") as outfile :
+with open("./results/products-v5.json", "w", encoding="utf-8") as outfile :
data = json.dump(products_, outfile, sort_keys=False, indent=3, ensure_ascii=False) \ No newline at end of file