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'}
它工作得很好。
因此,問題是我可以發送後調用隨機生成的數據嗎? 如果可以的話,那怎麼可能?
非常感謝!這工作 –