request post 问卷星

如何用post提交问卷星啊,求解答,我的问卷星提交后一直报22,没有提交成功

以下内容部分参考ChatGPT模型:


您可以使用Python的requests库来进行post提交问卷星。首先需要找到问卷星的提交接口,可以通过Chrome浏览器的开发者工具进行查看。然后使用requests.post()方法提交表单数据即可。以下是一个示例代码:

import requests

url = 'https://www.wjx.cn/joinnew/processjq.ashx'

data = {
    'submitdata': '1$单选题A;2$多选题A,B;3$填空题1',
    'curID': '123456',
    't': '0.123456',
    'starttime': '2022/2/22 22:22:22',
    'source': 'directphone',
    'submittype': '1',
    'ktimes': '1',
    'hlv': '1'
}

headers = {
    'Referer': 'https://www.wjx.cn/jq/123456.aspx',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
}

response = requests.post(url, data=data, headers=headers)

if response.status_code == 200 and '22' not in response.text:
    print('提交成功')
else:
    print('提交失败')

其中,url为问卷星的提交接口,data为表单数据,headers为请求头。在提交成功后,返回的响应内容中不应该包含22,否则提交失败。


如果我的建议对您有帮助、请点击采纳、祝您生活愉快