token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiZWM2ZWFjZjFjM2UzYzEyOWU3ODA4YjgwNzkxNGIzZjMiLCJleHAiOjE1NTU0OTE3MTIsImlhdCI6MTU1NDg4NjkxMn0.L_Xle5jhSEQbKpJ2bvQcMmo6mVqNgR6Yz30W5AElINk" headers["Authorization"]=token url="https://api.mk.xxx.com/openapi/robots/pearl/"+xxx+"/maps" files = {'file': open(mapsname+'.tar.gz', 'rb')} response = requests.post(url, headers=headers,files=files) result=response.json() print(result)
参考:http://docs.python-requests.org/en/master/user/quickstart/#make-a-request