diff --git a/API/__init__.py b/API/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/API/__pycache__/rok.cpython-313.pyc b/API/__pycache__/rok.cpython-313.pyc index 84770e9..76fbf38 100644 Binary files a/API/__pycache__/rok.cpython-313.pyc and b/API/__pycache__/rok.cpython-313.pyc differ diff --git a/API/__pycache__/rokky.cpython-313.pyc b/API/__pycache__/rokky.cpython-313.pyc new file mode 100644 index 0000000..fcec8c2 Binary files /dev/null and b/API/__pycache__/rokky.cpython-313.pyc differ diff --git a/API/df.py b/API/df.py new file mode 100644 index 0000000..cdde929 --- /dev/null +++ b/API/df.py @@ -0,0 +1,10 @@ +from rok import download_products, download_prices +from rokky import decrypt_and_unpack, add_product, update_prices + +download_products() +download_prices() + +decrypt_and_unpack("prices") +decrypt_and_unpack("products") +add_product() +update_prices() diff --git a/API/rok.py b/API/rok.py index 20a9ba2..de4a66a 100644 --- a/API/rok.py +++ b/API/rok.py @@ -48,7 +48,7 @@ def get_orders(access_token, page=1, page_size=25): print(response.json()) # return response.json() -def download_products(user_name): +def download_products(): url = f"https://cdn-partners.rokky.com/partner-catalogs/{user_name}_products.json.gz.enc" response = requests.get(url) @@ -63,8 +63,9 @@ def download_products(user_name): -def download_prices(partner_code): - url = f"https://cdn-partners.rokky.com/partner-catalogs/{partner_code}_prices.json.gz.enc" +def download_prices(): + + url = f"https://cdn-partners.rokky.com/partner-catalogs/{partner}_prices.json.gz.enc" response = requests.get(url) response.raise_for_status() diff --git a/services/rokky.py b/API/rokky.py similarity index 95% rename from services/rokky.py rename to API/rokky.py index 09122a2..4c82117 100644 --- a/services/rokky.py +++ b/API/rokky.py @@ -46,7 +46,7 @@ def decrypt_file(input_file, output_file, password): -def decrypt_and_unpack(name, password): +def decrypt_and_unpack(name): enc = f"./files/{name}.json.gz.enc" gz = f"./files/{name}.json.gz" json_file = f"./files/{name}.json" @@ -164,7 +164,7 @@ def add_product(): -def update_prices(conn): +def update_prices(): with open("./files/prices.json", "r") as f: prices = json.load(f) @@ -180,7 +180,7 @@ def update_prices(conn): conn.commit() -decrypt_and_unpack("prices", password) -decrypt_and_unpack("products", password) -add_product() -update_prices(conn) \ No newline at end of file +# decrypt_and_unpack("prices") +# decrypt_and_unpack("products") +# add_product() +# update_prices() \ No newline at end of file diff --git a/models/orders.py b/models/orders.py index 83b3b6a..946bd17 100644 --- a/models/orders.py +++ b/models/orders.py @@ -8,6 +8,7 @@ CREATE TABLE IF NOT EXISTS orders ( id INTEGER PRIMARY KEY AUTOINCREMENT, sku INTEGER UNIQUE, product_id INTEGER, + email TEXT, price TEXT, content TEXT ) diff --git a/services/__init__.py b/services/__init__.py new file mode 100644 index 0000000..e69de29