0
我试图让POST请求与循环用下面的代码的Python POST请求反复
description = fake.catch_phrase()
group_id = ''
invite_only = 1 if fake.boolean(chance_of_getting_true=50) == True else 0
is_public = 1 if fake.boolean(chance_of_getting_true=50) == True else 0
title = fake.company()
payload = {description,
group_id,
invite_only,
is_public,
title}
response = requests.post(createGroup, data=(payload), headers=headers)
我的服务器上 得到 SequelizeValidationError: notNull Violation: v_title cannot be null
但是,如果我尝试发送相同的有效载荷这样
payload = {'description': 'abc',
'group_id': '1',
'invite_only': '1',
'is_public': '1',
'title': 'someTitle'}
它工作得很好。
因此,问题是我可以发送后调用随机生成的数据吗? 如果可以的话,那怎么可能?
非常感谢!这工作 –