first commit
This commit is contained in:
commit
b9ffc105be
|
|
@ -0,0 +1,36 @@
|
|||
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 = {
|
||||
'brands': {
|
||||
1: {
|
||||
'id': 'brand_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'name_ru': 'Запорожец',
|
||||
'url': id_generator(16),
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
},
|
||||
2: {
|
||||
'id': 'brand_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'name_ru': 'BMW',
|
||||
'url': id_generator(16),
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
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 = {
|
||||
'groups': {
|
||||
1: {
|
||||
'id': 'group_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'picture_src': id_generator(16) + '.jpg',
|
||||
},
|
||||
2: {
|
||||
'id': 'group_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'picture_src': id_generator(16) + '.jpg',
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
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 = {
|
||||
'models': {
|
||||
1: {
|
||||
'id': 'model_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'year_from': 1999,
|
||||
'year_to': 2008,
|
||||
'brand_id': 'brand_rbmjh7flxc9zgr0r',
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
},
|
||||
2: {
|
||||
'id': 'model_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'year_from': 1999,
|
||||
'year_to': 2008,
|
||||
'brand_id': 'brand_rbmjh7flxc9zgr0r',
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
},
|
||||
3: {
|
||||
'id': 'model_' + id_generator(16),
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'year_from': 1999,
|
||||
'year_to': 2008,
|
||||
'brand_id': 'brand_rbmjh7flxc9zgr0r',
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
},
|
||||
}
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -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 = 'picture_' + id_generator(16)
|
||||
data = {
|
||||
'id': id,
|
||||
'file_name': id_generator(16) + '.jpg',
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
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 get_data():
|
||||
id = 'product_' + id_generator(16)
|
||||
return {
|
||||
'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',
|
||||
'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,
|
||||
}
|
||||
}
|
||||
|
||||
def test():
|
||||
id = 'product_' + id_generator(16)
|
||||
data = {
|
||||
'products': {
|
||||
1: get_data(),
|
||||
2: get_data(),
|
||||
3: get_data()
|
||||
}
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
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 = 'brand_' + id_generator(16)
|
||||
data = {
|
||||
'id': id,
|
||||
'name': id_generator(16),
|
||||
'name_ru': 'Запорожец',
|
||||
'url': id_generator(16),
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
'type': 10,
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
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 = 'group_' + id_generator(16)
|
||||
data = {
|
||||
'id': id,
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'picture_src': id_generator(16) + '.jpg',
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
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 = 'model_' + id_generator(16)
|
||||
data = {
|
||||
'id': id,
|
||||
'name': id_generator(16),
|
||||
'url': id_generator(16),
|
||||
'year_from': 1999,
|
||||
'year_to': 2008,
|
||||
'brand_id': 'brand_rbmjh7flxc9zgr0r',
|
||||
'picture_id': 'picture_75g36ayxk9yvl8lz',
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -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 = {
|
||||
'pictures': {
|
||||
1: {
|
||||
'id': 'picture_' + id_generator(16),
|
||||
'file_name': id_generator(16) + '.jpg',
|
||||
},
|
||||
2: {
|
||||
'id': 'picture_' + id_generator(16),
|
||||
'file_name': id_generator(16) + '.jpg',
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
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 = 'product_' + id_generator(16)
|
||||
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',
|
||||
'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,
|
||||
}
|
||||
}
|
||||
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)
|
||||
print(resp.json())
|
||||
|
||||
test()
|
||||
Loading…
Reference in New Issue