首页 > 编程语言 > 详细

python+requests——post提交文件

时间:2020-02-22 17:21:46      阅读:483      评论:0      收藏:0      [点我收藏+]
url = http://httpbin.org/post

files = {file: open(report.xls, rb)}

r = requests.post(url, files=files)


#你可以显式地设置文件名,文件类型和请求头:
url = http://httpbin.org/post

files = {file: (report.xls, open(report.xls, rb), application/vnd.ms-excel, {Expires: 0})}


r = requests.post(url, files=files)

 

技术分享图片

 

 

 

 

 

技术分享图片

 

python+requests——post提交文件

原文:https://www.cnblogs.com/xiaobaibailongma/p/12346209.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!