Guest User

Untitled

a guest
Apr 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import requests
  2.  
  3. odxvchsauth = <src_authcode> # source authcode (parsed as header)
  4. session_ID = <dest_authcode> # destination authcode (parsed as header)
  5.  
  6. srcurl = "https://us-texas-1-14.vchs.vmware.com/api/compute/transfer/75b72a35-e0c1-4f50-a728-bd01fc311c09/file"
  7. desturl = "https://66.70.145.232:443/cls/data/19dcf53b-d98d-41f7-be78-853f2f85e145/test.iso"
  8.  
  9. def upload():
  10. srcget = requests.get(srcurl, stream = True, headers = = {'Accept': 'application/*+xml;version=5.7', 'x-vcloud-authorization': odxvchsauth})
  11. for chunk in srcget.iter_content(chunksize = 1048576):
  12. uploadput = requests.put(desturl, data = chunk, stream = True, {'vmware-api-session-id': session_ID, 'Accept': 'application/json', 'Content-Type': 'application/octet-stream'}
  13.  
  14. upload()
Add Comment
Please, Sign In to add comment