首页 > 解决方案 > python3请求发布表单数据

问题描述

如何在 python 请求库中发布以下请求? 在此处输入图像描述

它适用于邮递员,但是当我尝试在 python 请求中运行它时,它显示不正确的结果。这是我的代码:

data ={'state': {'no': state_number}}
        input= {'input':data}
        headers = {'Content-type': 'multipart/form-data'}
        state_list = requests.post(url="http://myurl.com",data=input,headers=headers).json()

标签: pythonpython-3.xpython-requestspostman

解决方案


在邮递员中,您可以生成 python 代码:

在此处输入图像描述

在此处输入图像描述


推荐阅读