From 2c59f6d971ef100cfff3fcfacc81dc4bd168b534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=88=D0=B5=20=D0=98=D0=BC=D1=8F?= Date: Thu, 3 Apr 2025 14:54:35 +0500 Subject: [PATCH] up --- batchBrands.py | 2 +- batchCharacteristics.py | 30 ++++++++++++++++++++++++++++++ batchGroups.py | 2 +- batchModels.py | 2 +- batchPictures.py | 2 +- batchProducts.py | 2 +- batchValues.py | 30 ++++++++++++++++++++++++++++++ brand.py | 2 +- characteristic.py | 23 +++++++++++++++++++++++ exportOrders.py | 22 ++++++++++++++++++++++ exportUsers.py | 22 ++++++++++++++++++++++ group.py | 2 +- importOrders.py | 26 ++++++++++++++++++++++++++ importUsers.py | 26 ++++++++++++++++++++++++++ model.py | 6 +++--- picture.py | 2 +- product.py | 25 ++++++++++++++++--------- value.py | 23 +++++++++++++++++++++++ 18 files changed, 229 insertions(+), 20 deletions(-) create mode 100644 batchCharacteristics.py create mode 100644 batchValues.py create mode 100644 characteristic.py create mode 100644 exportOrders.py create mode 100644 exportUsers.py create mode 100644 importOrders.py create mode 100644 importUsers.py create mode 100644 value.py diff --git a/batchBrands.py b/batchBrands.py index a0c7560..f7f20ee 100644 --- a/batchBrands.py +++ b/batchBrands.py @@ -27,7 +27,7 @@ def test(): } } } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/batch-brands', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-brands', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/batchCharacteristics.py b/batchCharacteristics.py new file mode 100644 index 0000000..a54a456 --- /dev/null +++ b/batchCharacteristics.py @@ -0,0 +1,30 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + data = { + 'characteristics': { + 1: { + 'id': 'chtitle_' + id_generator(16), + 'title': id_generator(16), + }, + 2: { + 'id': 'chtitle_' + id_generator(16), + 'title': id_generator(16), + } + } + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-characteristics', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/batchGroups.py b/batchGroups.py index 670be8d..388a5e6 100644 --- a/batchGroups.py +++ b/batchGroups.py @@ -25,7 +25,7 @@ def test(): } } } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/batch-groups', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-groups', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/batchModels.py b/batchModels.py index d2251a9..199c73d 100644 --- a/batchModels.py +++ b/batchModels.py @@ -40,7 +40,7 @@ def test(): }, } } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/batch-models', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-models', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/batchPictures.py b/batchPictures.py index 28f1f08..9c1ae64 100644 --- a/batchPictures.py +++ b/batchPictures.py @@ -14,7 +14,7 @@ def test(): 'id': id, 'file_name': id_generator(16) + '.jpg', } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/picture', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/picture', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/batchProducts.py b/batchProducts.py index 7cac1ae..dd01249 100644 --- a/batchProducts.py +++ b/batchProducts.py @@ -41,7 +41,7 @@ def test(): 3: get_data() } } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/batch-products', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-products', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/batchValues.py b/batchValues.py new file mode 100644 index 0000000..eb8b354 --- /dev/null +++ b/batchValues.py @@ -0,0 +1,30 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + data = { + 'values': { + 1: { + 'id': 'chvalue_' + id_generator(16), + 'title': id_generator(16), + }, + 2: { + 'id': 'chvalue_' + id_generator(16), + 'title': id_generator(16), + } + } + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-values', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/brand.py b/brand.py index 36e544e..99553ad 100644 --- a/brand.py +++ b/brand.py @@ -18,7 +18,7 @@ def test(): 'picture_id': 'picture_75g36ayxk9yvl8lz', 'type': 10, } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/brand', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/brand', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/characteristic.py b/characteristic.py new file mode 100644 index 0000000..991b555 --- /dev/null +++ b/characteristic.py @@ -0,0 +1,23 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + id = 'chtitle_' + id_generator(16) + data = { + 'id': id, + 'title': 'test', + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/characteristic', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/exportOrders.py b/exportOrders.py new file mode 100644 index 0000000..535a233 --- /dev/null +++ b/exportOrders.py @@ -0,0 +1,22 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + data = { + 'to': 1742974769, + 'from': 1742974584, + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/export-orders', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/exportUsers.py b/exportUsers.py new file mode 100644 index 0000000..5937154 --- /dev/null +++ b/exportUsers.py @@ -0,0 +1,22 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + data = { + 'from': 0, + 'to': 1000000000, + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/export-users', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/group.py b/group.py index 3600a94..c4a6c39 100644 --- a/group.py +++ b/group.py @@ -16,7 +16,7 @@ def test(): 'url': id_generator(16), 'picture_src': id_generator(16) + '.jpg', } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/group', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/group', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/importOrders.py b/importOrders.py new file mode 100644 index 0000000..e951a11 --- /dev/null +++ b/importOrders.py @@ -0,0 +1,26 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + data = { + 'orders': [ + { + 'id': 'order_002d2542a1d14de6bc4715fdad05e683', + 'stage': 20, + } + ], + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/import-orders', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/importUsers.py b/importUsers.py new file mode 100644 index 0000000..22d8b29 --- /dev/null +++ b/importUsers.py @@ -0,0 +1,26 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + data = { + 'users': [ + { + 'id': 'user_003afe5e7be73b786b6250a27685913e', + 'status': 10, + } + ] + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/import-users', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file diff --git a/model.py b/model.py index 0816518..aa567c8 100644 --- a/model.py +++ b/model.py @@ -16,10 +16,10 @@ def test(): 'url': id_generator(16), 'year_from': 1999, 'year_to': 2008, - 'brand_id': 'brand_rbmjh7flxc9zgr0r', - 'picture_id': 'picture_75g36ayxk9yvl8lz', + 'brand_id': 'brand_rbmjh7flxc9zgr0r', # Смотри brand.py, + 'picture_id': 'picture_75g36ayxk9yvl8lz', # Смотри picture.py, } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/model', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/model', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/picture.py b/picture.py index f35c0ad..fe39994 100644 --- a/picture.py +++ b/picture.py @@ -21,7 +21,7 @@ def test(): } } } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/batch-pictures', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/batch-pictures', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/product.py b/product.py index f975e6a..e24061d 100644 --- a/product.py +++ b/product.py @@ -13,25 +13,32 @@ def test(): data = { 'id': id, 'name': id_generator(16), - 'tag': id_generator(16), 'price': 1999, 'old_price': 2008, 'quantity': 10, - 'model_id': 'model_rxbvlglyao59ef2s', - 'group_id': 'group_10c8f7l3lu7ydxhk', + 'count': 0, + 'model_id': 'model_006f52e9102a8d3be2fe5614f42ba989' # Смотри model.py, + 'group_id': 'group_1679091c5a880faf6fb5e6087eb1b2dc', # Смотри group.py, 'factory_num': '123qbc', 'vendor_num': '123qbc', 'oem': '123qbc', 'comment': '123qbc', 'is_new': 0, 'is_original': 1, - 'pictures_ids': ['picture_75g36ayxk9yvl8lz', 'picture_bpjunqpy94k36got', 'picture_nxyrvt9hggw2rff2', 'picture_y04kt98ernepnh1y',], - 'options': { - 'left': 1, - 'right': 0, - } + 'pictures_ids': [ # Смотри picture.py, + 'picture_00003e3b9e5336685200ae85d21b4f5e', + 'picture_000053b1e684c9e7ea73727b2238ce18', + 'picture_0001261e2060303a06ba6c64d676d639', + 'picture_00029153d12ae1c9abe59c17ff2e0895', + ], + 'characteristics': [ + { + 'key': 'chtitle_b28354b543375bfa94dabaeda722927f', # Смотри characteristic.py + 'value': 'chvalue_a6105c0a611b41b08f1209506350279e', # Смотри value.py + } + ] } - req = Request('POST', 'https://new2.spavto96.ru/api/v1.0/show-case/product', json=data, auth=('qwe', 'qwe')) + req = Request('POST', 'http://localhost/api/v1.0/show-case/product', json=data, auth=('qwe', 'qwe')) prepped = req.prepare() resp = s.send(prepped) print(resp.status_code) diff --git a/value.py b/value.py new file mode 100644 index 0000000..0800042 --- /dev/null +++ b/value.py @@ -0,0 +1,23 @@ +from requests import Request, Session +import hashlib +import string +import random + +s = Session() + +def id_generator(size=6, chars=string.ascii_lowercase + string.digits): + return ''.join(random.choice(chars) for _ in range(size)) + +def test(): + id = 'chvalue_' + id_generator(16) + data = { + 'id': id, + 'title': 'test', + } + req = Request('POST', 'http://localhost/api/v1.0/show-case/value', json=data, auth=('qwe', 'qwe')) + prepped = req.prepare() + resp = s.send(prepped) + print(resp.status_code) + print(resp.json()) + +test() \ No newline at end of file