Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. from json import load
  2. from requests import post
  3.  
  4. # GetServerBuildUploadUrl() has been called from Jenkins and its response is stored in a file.
  5. # Extract upload URL from json file
  6. UPLOAD_URL_FILE = 'upload_url.json'
  7. with open(UPLOAD_URL_FILE) as upload_url_file:    
  8.     upload_url = load(upload_url_file)['data']['URL']
  9. print(upload_url)
  10.  
  11. # Attempt to upload test zip file to
  12. files = {'file': ('TestFile.zip', open('TestFile.zip', 'rb'), 'application/x-zip-compressed')}
  13. r = post(upload_url, files=files)
  14.  
  15. print(r.status_code)
  16. print(r.text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement