python post 上传文件_python接口自动化7-post文件上传

前言

文件上传在我们软件是不可少的,最多的使用是体现在我们后台,当然我们前台也会有。但是了解过怎样上传文件吗?这篇我们以禅道文档-创建文档,上传文件为例。

post请求中的:Content-Type:multipart/form-data  这种类型便是上传文件。

一、环境安装、抓包分析

1、pip install requests_toolbelt,post请求 multipart/form-data  类型

C:\Users\Administrator>pip install requests_toolbelt

Requirement already satisfied: requests_toolbeltin d:\path_python\lib\site-packages (0.9.1)

Requirement already satisfied: requests<3.0.0,>=2.0.1 in d:\path_python\lib\site-packages (from requests_toolbelt) (2.20.1)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in d:\path_python\lib\site-packages (from requests<3.0.0,>=2.0.1->requests_toolbelt) (3.0.4)

Requirement already satisfied: certifi>=2017.4.17 in d:\path_python\lib\site-packages (from requests<3.0.0,>=2.0.

你可能感兴趣的:(python,post,上传文件)