Tuesday 15 September 2015

python - transpose curl PUT to requests.put -


I would like to move the curl command (which uploads a local file in the rackspace)

 < Code> curl -x pattern-t screens / hello JPG-D - \ "H-X-Ath-Token: FC 81 AAIA 6919-19 9 -9-B-09-94-AAA 9 988 9EE" \ https: //storage101.dfw1. Clouddrive.com/v1/ Python requests for CF_xer7_343 / images / hello.jpg   

So far I have:

  url = 'http: / /storage.clouddrive.com/v1/CF_xer7_343/images/hello.jpg 'Header = {' X-Auth-Token ':' Fc81aaa6-98a1-9ab0-94ba-aba9a89aa9ae '} Request = Request. Input (URL, Headers = Header, Data = {})   

Where do I specify that I am Screenshots / Hello.jpg ?

I understand that the 'FTP server' represents the curl in -T , but I have searched but FTP can not be found. / P>

no, -t means 'upload this file', which

     

with open ('screenies / hello.jpg' , 'Rb') as image: request = requests.put (url, headers = headers, data = image)

Where data image data for you Will read and upload.

No comments:

Post a Comment