30 lines
795 B
Python
30 lines
795 B
Python
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() |