怎么用python模拟这段提交????
本帖最后由 dmxgaj 于 2020-8-6 10:38 编辑<div class="layui-container" >
<form class="layui-form layui-form-school" enctype="multipart/form-data" method="post" action="/index/appform/save">
<div class="layui-form-item">
<p><span>*</span> 选择:<span style="color:red;">(请刷新)</span></p>
<div class="layui-input-block">
<select name="school">
<option value="1" selected="">测试1</option>
<option value="2" selected="">测试2</option>
<option value="3" selected="">测试3</option>
</select>
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 姓名:<span style="color:red;">姓名</span></p>
<div class="layui-input-block">
<input type="text" name="student" lay-verify="required" placeholder="请输入姓名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 性别:</p>
<div class="layui-input-block">
<select name="sex">
<option value="男" selected>男</option>
<option value="女" >女</option>
</select>
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 出生日期:</p>
<div class="layui-input-block">
<input type="text" name="birthday" lay-verify="required" class="layui-input" id="birthday"placeholder="请选择生日" readonly="readonly">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 身份证号:</p>
<div class="layui-input-block">
<input type="text" name="id_card" lay-verify="required|identity" placeholder="请输入身份证号码" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 住址:<span style="color:red;">住址</span></p>
<div class="layui-input-block">
<input type="text" name="address" lay-verify="required" placeholder="请输入住址" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 监护姓名:</p>
<div class="layui-input-block">
<input type="text" name="parent" lay-verify="required" placeholder="请输入监护姓名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 监护联系电话:</p>
<div class="layui-input-block">
<input type="text" name="tell" lay-verify="required|phone" placeholder="请输入监护联系电话" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 图片1:<br><span style="color:red;">图片1</span></p>
<div class="layui-input-block">
<input type="file" name="pic[]" lay-verify="required" placeholder="请上传图片1" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<p><span>*</span> 图片2:<br><span style="color:red;">图片2</span></p>
<div class="layui-input-block">
<input type="file" name="pic[]" lay-verify="required" placeholder="请上传图片2" class="layui-input">
</div>
</div>
<input type="hidden" name="time" value="1596677446">
<br>
<div class="layui-form-item">
<div class="layui-input-block center">
<button class="layui-btn layui-btn-warm" lay-submit lay-filter="formDemo">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
</div>
你是要发悬赏帖吧 livcui 发表于 2020-8-6 10:33
你是要发悬赏帖吧
发的就是悬赏贴。{:5_109:} import requests
headers = {'user-agent': 'firefox'}
# 1)传字符串
#files = {'file': '字符串'}
# 2)传文件
files = {'file': open('test.txt', 'r')}
r = requests.post('http://httpbin.org/post', headers=headers, files=files)
print(r.text) suchocolate 发表于 2020-8-6 20:43
试过不行。multipart/form-data dmxgaj 发表于 2020-8-7 00:26
试过不行。multipart/form-data
我的只是案例,供参考。
具体问题具体分析,把你的全部代码和报错发出来。
页:
[1]