nginx commits12
This commit is contained in:
parent
08a6648f1e
commit
839bc69202
76
API/rok.py
76
API/rok.py
|
|
@ -29,6 +29,7 @@ def tokens():
|
||||||
return access_token
|
return access_token
|
||||||
|
|
||||||
access_token = tokens()
|
access_token = tokens()
|
||||||
|
# print(access_token)
|
||||||
def get_orders(access_token, page=1, page_size=25):
|
def get_orders(access_token, page=1, page_size=25):
|
||||||
url = f"{BASE_URL}/orders"
|
url = f"{BASE_URL}/orders"
|
||||||
|
|
||||||
|
|
@ -57,7 +58,7 @@ def download_products(user_name):
|
||||||
|
|
||||||
print("Каталог продуктов скачан.")
|
print("Каталог продуктов скачан.")
|
||||||
|
|
||||||
# download_products(user_name)
|
|
||||||
# get_orders(access_token)
|
# get_orders(access_token)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -74,7 +75,78 @@ def download_prices(partner_code):
|
||||||
print("Каталог цен скачан.")
|
print("Каталог цен скачан.")
|
||||||
|
|
||||||
|
|
||||||
download_prices(partner)
|
def create_order(access_token, sku, quantity, unit_price, partner_order_id):
|
||||||
|
url = f"{BASE_URL}/orders"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Bearer {access_token}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"sku": sku,
|
||||||
|
"quantity": quantity,
|
||||||
|
"unitPrice": unit_price
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"partnerOrderId": partner_order_id
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(url, headers=headers, json=payload)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
def get_orders(access_token, page=1, page_size=25):
|
||||||
|
url = f"{BASE_URL}/orders"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Bearer {access_token}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"page": page,
|
||||||
|
"pageSize": page_size
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(url, headers=headers, json=payload)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
|
||||||
|
def get_order_content(order_id):
|
||||||
|
url = f"{BASE_URL}/orders/{order_id}/content"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Bearer {access_token}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
data = response.json()
|
||||||
|
con = data['orderContentItems']
|
||||||
|
for c in con:
|
||||||
|
content = c['content']
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
content = get_order_content(5379484)
|
||||||
|
print(content)
|
||||||
|
|
||||||
|
# orders = get_orders(access_token)
|
||||||
|
# print(orders)
|
||||||
|
|
||||||
|
|
||||||
|
# order = create_order(access_token, 22774, 1, 21.17, "my-test-order-123")
|
||||||
|
# print(order)
|
||||||
|
|
||||||
|
|
||||||
|
# download_prices(partner)
|
||||||
|
# download_products(user_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ WORKDIR /app
|
||||||
RUN uv sync --frozen
|
RUN uv sync --frozen
|
||||||
|
|
||||||
# Expose port 8000
|
# Expose port 8000
|
||||||
EXPOSE 8005
|
EXPOSE 5205
|
||||||
|
|
||||||
|
|
||||||
# Presuming there is a `my_app` command provided by the project uvicorn main:app --reload
|
# Presuming there is a `my_app` command provided by the project uvicorn main:app --reload
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,5 +1,8 @@
|
||||||
from flask import Blueprint
|
from flask import Blueprint, request, jsonify
|
||||||
# from services.rokky import ones
|
# from services.rokky import ones
|
||||||
|
from API.rok import get_order_content
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
main = Blueprint("main", __name__)
|
main = Blueprint("main", __name__)
|
||||||
|
|
||||||
|
|
@ -17,3 +20,25 @@ def index1():
|
||||||
@main.route("/sales", methods=["POST", "GET"])
|
@main.route("/sales", methods=["POST", "GET"])
|
||||||
def index2():
|
def index2():
|
||||||
return "Hello GET"
|
return "Hello GET"
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/newOrder", methods=["POST"])
|
||||||
|
def new_order():
|
||||||
|
if not request.is_json:
|
||||||
|
return jsonify({"error": "Invalid content type"}), 400
|
||||||
|
|
||||||
|
data = request.get_json()
|
||||||
|
print(data)
|
||||||
|
order_id = data.get("orderId")
|
||||||
|
if order_id is None:
|
||||||
|
return jsonify({"error": "orderId is required"}), 400
|
||||||
|
|
||||||
|
if not isinstance(order_id, int):
|
||||||
|
return jsonify({"error": "orderId must be int"}), 400
|
||||||
|
|
||||||
|
# TODO: обработка заказа
|
||||||
|
print(f"New order received: {order_id}")
|
||||||
|
logging.warn(get_order_content(order_id))
|
||||||
|
logging.warn(f"newOrder: {order_id}")
|
||||||
|
|
||||||
|
return jsonify({"status": "ok"}), 200
|
||||||
|
|
@ -1,11 +1,25 @@
|
||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
container_name: nginx
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
- "443:443"
|
||||||
|
volumes:
|
||||||
|
- ./nginx/conf.d:/etc/nginx/conf.d
|
||||||
|
- ./nginx/certbot/www:/var/www/certbot
|
||||||
|
- ./nginx/certbot/conf:/etc/letsencrypt
|
||||||
|
depends_on:
|
||||||
|
- flask
|
||||||
|
restart: always
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
container_name: flask-dev
|
container_name: flask-dev
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000" # Пробрасываем порт наружу
|
- "5205:5205" # Пробрасываем порт наружу
|
||||||
volumes:
|
volumes:
|
||||||
# Главная строка: монтируем текущую папку с кодом (.)
|
# Главная строка: монтируем текущую папку с кодом (.)
|
||||||
# в папку /app внутри контейнера
|
# в папку /app внутри контейнера
|
||||||
|
|
|
||||||
13
main.py
13
main.py
|
|
@ -1,5 +1,18 @@
|
||||||
from app import create_app
|
from app import create_app
|
||||||
from services.tim import start_scheduler
|
from services.tim import start_scheduler
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
filename="./logs/logss.log",
|
||||||
|
level=logging.WARN,
|
||||||
|
# format="%(asctime)s - %(message)s",
|
||||||
|
format="%(asctime)s [%(filename)s:%(lineno)d] - %(message)s",
|
||||||
|
datefmt="%Y-%m-%d %H:%M:%S",
|
||||||
|
# encoding='utf-8' # Указание кодировки UTF-8
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
start_scheduler()
|
start_scheduler()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ cursor.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS products (
|
CREATE TABLE IF NOT EXISTS products (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
sku INTEGER UNIQUE,
|
sku INTEGER UNIQUE,
|
||||||
|
product_type TEXT,
|
||||||
product_id INTEGER,
|
product_id INTEGER,
|
||||||
name TEXT,
|
name TEXT,
|
||||||
developer TEXT,
|
developer TEXT,
|
||||||
|
|
@ -14,7 +15,10 @@ CREATE TABLE IF NOT EXISTS products (
|
||||||
cover TEXT,
|
cover TEXT,
|
||||||
release_date TEXT,
|
release_date TEXT,
|
||||||
genres TEXT,
|
genres TEXT,
|
||||||
price TEXT
|
price TEXT,
|
||||||
|
price_gg TEXT,
|
||||||
|
price_sales TEXT,
|
||||||
|
price_salesgg TEXT
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ CREATE TABLE IF NOT EXISTS orders (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
sku INTEGER UNIQUE,
|
sku INTEGER UNIQUE,
|
||||||
product_id INTEGER,
|
product_id INTEGER,
|
||||||
price TEXT
|
price TEXT,
|
||||||
|
content TEXT
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
|
||||||
258
services/gg.py
258
services/gg.py
|
|
@ -1,258 +0,0 @@
|
||||||
import requests
|
|
||||||
import time
|
|
||||||
import json
|
|
||||||
import hashlib
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
import os
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
TOKEN = os.getenv('GGTOKEN')
|
|
||||||
SELLER_ID = os.getenv('SELLER_ID')
|
|
||||||
API_KEY = os.getenv('GGTOKEN')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TOKEN_FILE = "./files/ggsel_token.json"
|
|
||||||
|
|
||||||
|
|
||||||
def save_token(token):
|
|
||||||
with open(TOKEN_FILE, "w") as f:
|
|
||||||
json.dump({"token": token}, f)
|
|
||||||
|
|
||||||
|
|
||||||
def load_token():
|
|
||||||
if not os.path.exists(TOKEN_FILE):
|
|
||||||
return None
|
|
||||||
|
|
||||||
with open(TOKEN_FILE) as f:
|
|
||||||
try:
|
|
||||||
data = json.load(f)
|
|
||||||
return data.get("token")
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def safe_json(response):
|
|
||||||
if not response.text:
|
|
||||||
raise Exception("Empty response from API")
|
|
||||||
|
|
||||||
try:
|
|
||||||
return response.json()
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print("Invalid JSON response:")
|
|
||||||
print(response.text)
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
def get_token():
|
|
||||||
timestamp = str(int(time.time()))
|
|
||||||
sign_string = API_KEY + timestamp
|
|
||||||
sign = hashlib.sha256(sign_string.encode()).hexdigest()
|
|
||||||
|
|
||||||
url = "https://seller.ggsel.com/api_sellers/api/apilogin"
|
|
||||||
|
|
||||||
payload = {
|
|
||||||
"seller_id": SELLER_ID,
|
|
||||||
"timestamp": timestamp,
|
|
||||||
"sign": sign
|
|
||||||
}
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept": "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
response = requests.post(url, json=payload, headers=headers)
|
|
||||||
|
|
||||||
print(response.status_code)
|
|
||||||
res = response.json()
|
|
||||||
token = res['token']
|
|
||||||
|
|
||||||
save_token(token)
|
|
||||||
print(token)
|
|
||||||
return token
|
|
||||||
|
|
||||||
|
|
||||||
def balans():
|
|
||||||
token = load_token()
|
|
||||||
|
|
||||||
if not token:
|
|
||||||
token = get_token()
|
|
||||||
|
|
||||||
url = "https://seller.ggsel.com/api_sellers/api/sellers/account/balance/info"
|
|
||||||
|
|
||||||
headers = {"Accept": "application/json"}
|
|
||||||
params = {"token": token}
|
|
||||||
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
print(r.status_code)
|
|
||||||
|
|
||||||
# если токен умер
|
|
||||||
if r.status_code in (401, 403):
|
|
||||||
token = get_token()
|
|
||||||
params["token"] = token
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
|
|
||||||
return r.json()
|
|
||||||
|
|
||||||
def last_sales(top=10, group=False):
|
|
||||||
token = load_token()
|
|
||||||
|
|
||||||
if not token:
|
|
||||||
token = get_token()
|
|
||||||
|
|
||||||
url = "https://seller.ggsel.com/api_sellers/api/seller-last-sales"
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"Accept": "application/json",
|
|
||||||
"locale": "ru"
|
|
||||||
}
|
|
||||||
|
|
||||||
params = {
|
|
||||||
"token": token,
|
|
||||||
"seller_id": SELLER_ID,
|
|
||||||
"top": top,
|
|
||||||
"group": str(group).lower()
|
|
||||||
}
|
|
||||||
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
print(r.status_code)
|
|
||||||
|
|
||||||
# если токен умер
|
|
||||||
if r.status_code in (401, 403):
|
|
||||||
token = get_token()
|
|
||||||
params["token"] = token
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
|
|
||||||
return r.json()
|
|
||||||
|
|
||||||
|
|
||||||
# print(last_sales())
|
|
||||||
|
|
||||||
def get_messages(id_i, id_from=None, id_to=None, newer=None, count=50):
|
|
||||||
token = load_token()
|
|
||||||
|
|
||||||
if not token:
|
|
||||||
token = get_token()
|
|
||||||
|
|
||||||
url = "https://seller.ggsel.com/api_sellers/api/debates/v2"
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"Accept": "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
params = {
|
|
||||||
"token": token,
|
|
||||||
"id_i": id_i,
|
|
||||||
"count": min(count, 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
if id_from:
|
|
||||||
params["id_from"] = id_from
|
|
||||||
|
|
||||||
if id_to:
|
|
||||||
params["id_to"] = id_to
|
|
||||||
|
|
||||||
if newer:
|
|
||||||
params["newer"] = newer
|
|
||||||
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
print(r.status_code)
|
|
||||||
|
|
||||||
# если токен умер
|
|
||||||
if r.status_code in (401, 403):
|
|
||||||
token = get_token()
|
|
||||||
params["token"] = token
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
|
|
||||||
return r.json()
|
|
||||||
|
|
||||||
|
|
||||||
# пример
|
|
||||||
print(get_messages(id_i=18840912))
|
|
||||||
|
|
||||||
|
|
||||||
def get_chats(page=1, pagesize=20, filter_new=None, email=None, id_ds=None):
|
|
||||||
token = load_token()
|
|
||||||
|
|
||||||
if not token:
|
|
||||||
token = get_token()
|
|
||||||
|
|
||||||
url = "https://seller.ggsel.com/api_sellers/api/debates/v2/chats"
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"Accept": "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
params = {
|
|
||||||
"token": token,
|
|
||||||
"page": page,
|
|
||||||
"pagesize": pagesize
|
|
||||||
}
|
|
||||||
|
|
||||||
if filter_new is not None:
|
|
||||||
params["filter_new"] = filter_new
|
|
||||||
|
|
||||||
if email:
|
|
||||||
params["email"] = email
|
|
||||||
|
|
||||||
if id_ds:
|
|
||||||
params["id_ds"] = id_ds
|
|
||||||
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
print(r.status_code)
|
|
||||||
|
|
||||||
# если токен умер
|
|
||||||
if r.status_code in (401, 403):
|
|
||||||
token = get_token()
|
|
||||||
params["token"] = token
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
|
|
||||||
return r.json()
|
|
||||||
|
|
||||||
|
|
||||||
# пример
|
|
||||||
# print(get_chats())
|
|
||||||
# def tokens():
|
|
||||||
|
|
||||||
# timestamp = str(int(time.time()))
|
|
||||||
# sign_string = API_KEY + timestamp
|
|
||||||
# sign = hashlib.sha256(sign_string.encode()).hexdigest()
|
|
||||||
|
|
||||||
# url = "https://seller.ggsel.com/api_sellers/api/apilogin"
|
|
||||||
|
|
||||||
# payload = {
|
|
||||||
# "seller_id": SELLER_ID,
|
|
||||||
# "timestamp": timestamp,
|
|
||||||
# "sign": sign
|
|
||||||
# }
|
|
||||||
|
|
||||||
# headers = {
|
|
||||||
# "Content-Type": "application/json",
|
|
||||||
# "Accept": "application/json"
|
|
||||||
# }
|
|
||||||
|
|
||||||
# response = requests.post(url, json=payload, headers=headers)
|
|
||||||
|
|
||||||
# print(response.status_code)
|
|
||||||
# res = response.json()
|
|
||||||
# token = res['token']
|
|
||||||
# return token
|
|
||||||
|
|
||||||
|
|
||||||
# def balans():
|
|
||||||
# url = "https://seller.ggsel.com/api_sellers/api/sellers/account/balance/info"
|
|
||||||
|
|
||||||
# params = {
|
|
||||||
# "token": tokens()
|
|
||||||
# }
|
|
||||||
|
|
||||||
# headers = {
|
|
||||||
# "Accept": "application/json"
|
|
||||||
# }
|
|
||||||
|
|
||||||
# response = requests.get(url, params=params, headers=headers)
|
|
||||||
|
|
||||||
# print(response.status_code)
|
|
||||||
# print(response.json())
|
|
||||||
|
|
@ -46,17 +46,39 @@ def decrypt_file(input_file, output_file, password):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
decrypt_file(
|
def decrypt_and_unpack(name, password):
|
||||||
"./files/prices.json.gz.enc",
|
enc = f"./files/{name}.json.gz.enc"
|
||||||
"./files/prices.json.gz",
|
gz = f"./files/{name}.json.gz"
|
||||||
password
|
json_file = f"./files/{name}.json"
|
||||||
)
|
|
||||||
def archive():
|
decrypt_file(enc, gz, password)
|
||||||
with gzip.open("./files/prices.json.gz", "rb") as f_in:
|
|
||||||
with open("./files/prices.json", "wb") as f_out:
|
with gzip.open(gz, "rb") as f_in:
|
||||||
|
with open(json_file, "wb") as f_out:
|
||||||
shutil.copyfileobj(f_in, f_out)
|
shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
archive()
|
print(f"Готово: {json_file}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# decrypt_file(
|
||||||
|
# "./files/prices.json.gz.enc",
|
||||||
|
# "./files/prices.json.gz",
|
||||||
|
# password
|
||||||
|
# )
|
||||||
|
# def archive():
|
||||||
|
# with gzip.open("./files/prices.json.gz", "rb") as f_in:
|
||||||
|
# with open("./files/prices.json", "wb") as f_out:
|
||||||
|
# shutil.copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
|
# archive()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def prices():
|
||||||
|
|
||||||
with open("./files/prices.json", "r", encoding="utf-8") as f:
|
with open("./files/prices.json", "r", encoding="utf-8") as f:
|
||||||
products = json.load(f)
|
products = json.load(f)
|
||||||
|
|
||||||
|
|
@ -78,6 +100,7 @@ def save_product(conn, product):
|
||||||
INSERT INTO products (
|
INSERT INTO products (
|
||||||
sku,
|
sku,
|
||||||
product_id,
|
product_id,
|
||||||
|
product_type,
|
||||||
name,
|
name,
|
||||||
developer,
|
developer,
|
||||||
publisher,
|
publisher,
|
||||||
|
|
@ -85,9 +108,10 @@ def save_product(conn, product):
|
||||||
release_date,
|
release_date,
|
||||||
genres
|
genres
|
||||||
)
|
)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
ON CONFLICT(sku) DO UPDATE SET
|
ON CONFLICT(sku) DO UPDATE SET
|
||||||
product_id=excluded.product_id,
|
product_id=excluded.product_id,
|
||||||
|
product_type = excluded.product_type,
|
||||||
name=excluded.name,
|
name=excluded.name,
|
||||||
developer=excluded.developer,
|
developer=excluded.developer,
|
||||||
publisher=excluded.publisher,
|
publisher=excluded.publisher,
|
||||||
|
|
@ -97,6 +121,7 @@ def save_product(conn, product):
|
||||||
""", (
|
""", (
|
||||||
product["sku"],
|
product["sku"],
|
||||||
product["product_id"],
|
product["product_id"],
|
||||||
|
product["product_type"],
|
||||||
product["name"],
|
product["name"],
|
||||||
product["developer"],
|
product["developer"],
|
||||||
product["publisher"],
|
product["publisher"],
|
||||||
|
|
@ -109,6 +134,8 @@ def save_product(conn, product):
|
||||||
|
|
||||||
|
|
||||||
def add_product():
|
def add_product():
|
||||||
|
with open("./files/products.json", "r", encoding="utf-8") as f:
|
||||||
|
products = json.load(f)
|
||||||
parsed_products = []
|
parsed_products = []
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -118,6 +145,7 @@ def add_product():
|
||||||
parsed = {
|
parsed = {
|
||||||
"sku": product["sku"],
|
"sku": product["sku"],
|
||||||
"product_id": product["product_id"],
|
"product_id": product["product_id"],
|
||||||
|
"product_type":product["product_type"],
|
||||||
"name": get_title(product, "RU"),
|
"name": get_title(product, "RU"),
|
||||||
"developer": product["developer"],
|
"developer": product["developer"],
|
||||||
"publisher": product["publisher"],
|
"publisher": product["publisher"],
|
||||||
|
|
@ -129,7 +157,7 @@ def add_product():
|
||||||
parsed_products.append(parsed)
|
parsed_products.append(parsed)
|
||||||
for product in parsed_products:
|
for product in parsed_products:
|
||||||
save_product(conn, product)
|
save_product(conn, product)
|
||||||
# print(parsed_products[10])
|
print(parsed_products[3])
|
||||||
|
|
||||||
print("Всего продуктов:", len(products))
|
print("Всего продуктов:", len(products))
|
||||||
|
|
||||||
|
|
@ -152,5 +180,7 @@ def update_prices(conn):
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
# add_product()
|
decrypt_and_unpack("prices", password)
|
||||||
|
decrypt_and_unpack("products", password)
|
||||||
|
add_product()
|
||||||
update_prices(conn)
|
update_prices(conn)
|
||||||
Loading…
Reference in New Issue