requests-文件上传

1 import requests
2 files = {'file':open('D://tomas.jpg','rb')}#设定一个files,打开文件对象
3 response = requests.post('http://httpbin.org/post',files=files)
4 print(response.text)

 

posted @ 2017-05-11 22:29  道高一尺  阅读(303)  评论(0编辑  收藏  举报