diff options
| author | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-21 13:01:27 +0200 |
|---|---|---|
| committer | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-21 13:01:27 +0200 |
| commit | 6fb262d7f6feb6105ec73a9dcd97f27783ce8b17 (patch) | |
| tree | 8efc8c6023fe63ee518b950d14becd1da63a8d09 /python/products-dict-v5.py | |
| parent | b3c65fd8699506a3450b506feb7d7a80e62919ee (diff) | |
| download | linkeysearch-6fb262d7f6feb6105ec73a9dcd97f27783ce8b17.tar.gz linkeysearch-6fb262d7f6feb6105ec73a9dcd97f27783ce8b17.tar.bz2 linkeysearch-6fb262d7f6feb6105ec73a9dcd97f27783ce8b17.zip | |
new node-js implementation; input from json
Diffstat (limited to 'python/products-dict-v5.py')
| -rw-r--r-- | python/products-dict-v5.py | 14 |
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 |
