This commit is contained in:
Alex55 2026-03-19 15:31:15 +02:00
parent 5adbba5b24
commit abbd9837db
8 changed files with 21 additions and 9 deletions

0
API/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

10
API/df.py Normal file
View File

@ -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()

View File

@ -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()

View File

@ -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)
# decrypt_and_unpack("prices")
# decrypt_and_unpack("products")
# add_product()
# update_prices()

View File

@ -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
)

0
services/__init__.py Normal file
View File