python实现文件上传接口

阅读: 评论:0

python实现文件上传接口

python实现文件上传接口

python实现文件上传接口测试

可抓包查看上传接口信息,以下为例


代码实现如下

def upload():url="xxx"# 抓包获取的文件的file信息files = {"file":("keai.png",open("1.png",'rb'),"image/png")}# 抓包获取到的表单信息data={"fileMd5":"fileMd5Computed","chunks":1,"chunk": 0,"id":0,"lastModifiedDate":"1669536432","filename":"1.png","size":5465}to=login()headers={"token":to}resp = quest('post', url,json=data,files=files,headers=headers))
上传成功后返回
{"status":1,"data":{"fileid":"MDAwMDAwMDAwMLOGz5mGua-xhM5-mQ","ext":"https://assets.ketangpai/openapiv5/Public/Common/img/fileicon/file_ext_big_txt.png","ext_s":"https://assets.ketangpai/openapiv5/Public/Common/img/fileicon/file_ext_big_txt.png","ext_type":"txt","size":"5.21KB","name":&#","url":"https://downloadv5.ketangpai/File/download/id/MDAwMDAwMDAwMLOGz5mGua-xhM5-mQ/expires/1681627904/sign/af312c88f0fc1777fe955b10f01e6e598506fab8/token/e5dad8ce0c41c1ecce2b1de6b3512f5a6ed0b6b16872c6d4582c195ba3c99346/uid/MDAwMDAwMDAwMLSsrZiGubNphNtyoQ.html","date":"2023-04-16 12:51","rurl":"https://openapiv5.ketangpai/PluginApp/to/id/MDAwMDAwMDAwMLOGz5mGua-xhM5-mQ/expires/1681627904/sign/af312c88f0fc1777fe955b10f01e6e598506fab8/token/e5dad8ce0c41c1ecce2b1de6b3512f5a6ed0b6b16872c6d4582c195ba3c99346/uid/MDAwMDAwMDAwMLSsrZiGubNphNtyoQ.html"},"code":12003,"message":"u4e0au4f20u6210u529f"}

本文发布于:2024-01-28 01:42:14,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/17063773383908.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:文件上传   接口   python
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23