23 lines
561 B
Python
23 lines
561 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():
|
|
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() |