python post上传文件
python post上传文件
import requests import json url = 'http://cnbim.com/upload' file_path = 'path/1/2/file.jpg' data = { 'file': open(file_path, 'rb'), 'id': 's1', # add other fields as needed } r = requests.post(url, json=data) print(r.text)
########################
QQ 3087438119