请求发布文件成功但不存在文件

时间:2019-03-14 05:24:34

标签: python post python-requests

站点:http://221.226.86.226:9012/nyqc//uploader.jsp?ftype=0&type=2&relationId=338&bussiId=20190313162759510770#

我尝试使用

m = MultipartEncoder(fields={
    'file': (os.path.basename(filepath), open(filepath, 'rb'), "image/jpeg")
})

html = requests.post(
    'http://221.226.86.226:9012/nyqc/material/up.action?type=2&ftype=0&relationId=338&bussiId=20190313162759510770&flowNum=&uploadType=',
    headers={
        'Content-Type':
        m.content_type,
        'Cookie':
        'JSESSIONID=0770696F2B043103883B2DA46D465BDC',
        'Host':
        '221.226.86.226:9012',
        'Referer':
        'http://221.226.86.226:9012/nyqc//js/plupload/plupload.flash.swf',
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'
    },
    data=m,
    timeout=10)

html = requests.post(
'http://221.226.86.226:9012/nyqc/material/up.action?type=2&ftype=0&relationId=338&bussiId=20190313162759510770&flowNum=&uploadType=',
headers={
    'Cookie':
    'JSESSIONID=0770696F2B043103883B2DA46D465BDC',
    'Host':
    '221.226.86.226:9012',
    'Referer':
    'http://221.226.86.226:9012/nyqc//js/plupload/plupload.flash.swf',
    'User-Agent':
    'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'
},
files={'file': open(filepath, 'rb')},
timeout=10)

可以返回成功消息({“ status”:true,“ newName”:“ null”}),但未加载任何文件。

0 个答案:

没有答案