#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
headers = {‘uuid‘: ‘5cb572b7-c0a7-4d90-81a4-58d24f3e2949‘}
cookies={‘Cookie‘:‘pinId=9-Qim4TWS0e1ffsfn98I-w; unick=baiduyun; _tp=%2FS9%2FIuEE3omErKosHnjrkA%3D%3D; _pst=diwutest; shshshfpb=064e0f58dea3d43847b6516901b14674993962ef0644052905b1257b0f; shshshfpa=8844adde-6b79-115f-662e-dce4861274e4-1546416999; ipLoc-djd=1-72-2799-0; user-key=aad54864-dd7f-4a86-a6f6-3034809a66cf; cn=0; __jdu=15464169946011338519555; PCSYCityID=1; __jdv=137720036|direct|-|none|-|1547728064910; ceshi3.com=FhzONB_wVBb6qiqIepTRLFrZm6LZInPQE-GsGaDVwZA; sso.jd.com=97c719308f2d4183804489d56d61052e; ipLocation=%u5317%u4EAC; areaId=1; TrackID=1NjFiA6_It51PA9RWY7I_Lg8yk3hRh75Sq6pKhGi8gJcYtyFkOPbqvipSPZD7oyiCwNql_Mk3bcCU6PtLs-aZSUgIQnJRv0KpjrtbOgrZjNeU8RODCiX5RcIbJ3SSTLyl; pin=diwutest; shshshfp=745ce9fb2e06cbb047e3761c53131da3; _gcl_au=1.1.2069307015.1548146424; thor=40FE399368DC7E805A3F9D34B7666C27B4F32A36A433F2B36D3481FE1DDF0DD49B6A9CFBFE7E652315D523361FB0172031311C59D0BFDE97F68EB3D9EC6BB229F2BDF23FBD98C1E733AEAFF724ED7CE2F2246C5F7625D6DEC89E513002771E6DCB2C5CF0BB9B58A07C6EF5C898FB79365EE598E3A96E18AC1D602674F7C41015AF685991EA120ABCD82AB76FF03B2E16EE4CAEC98949AF7FE0F4511085077B0A; lighting=CB8AB93B51C066CD6223DCD4177559C82FB8762517F346B96AB1BC0874D1A48DC57777700CC475E07E8561638942A8CE40C75E1EEF7FFB76F8198AD312B314ED9BD145A002AD57B05B24FB5538F7D573D168A8F2DC02750557584E8B6376519DA14E822CA7BE475655F6918013B1827D70EF9701BD5B6C810F8D460EF1FF04DD1E9F7B3CF4B298E21C0F32495BBBDBC0A84CF56D5FA025A46; __jda=137720036.15464169946011338519555.1546416995.1548139939.1548146424.68; __jdc=137720036; 3AB9D23F7A4B3C9B=BYVJGMSEULDXQIUTXXSIXZGQZOMDM5S67AOMUA7YUQ647NQ3BTIMIGR77UJB6FBLT7TLSO5ZJVDEJTLDIF4J47F2VQ‘}
data = {}
r = requests.post(‘http://baidu.com/api/baiduyun/upload‘, cookies=cookies, data=data,files={‘file‘:open(‘/Users/Desktop/test.csv‘,‘rb‘)}, headers=headers)
print "======Response data======"
print r.text
print r.url
print r.headers
print "======Request Header======"
print r.request.headers
原文地址:https://www.cnblogs.com/leodaxin/p/10305403.html