Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. def create_asset(metadata, file_name):
  2. credentials = '{username}:{password}'.format(username=conf['username'], password=conf['password'])
  3. auth_value = b64encode(credentials.encode())
  4. headers = {
  5. 'Authorization': '{type} {auth_value}'.format(type="Basic", auth_value=auth_value.decode()),
  6. 'Content-Type': 'application/json'
  7. }
  8. request_url = conf['artifact_endpoint']
  9. response = requests.post(request_url, data=metadata, headers=headers, verify=False)
  10. if not response.ok:
  11. print("Error while creating the asset {}".format(file_name))
  12. else:
  13. print("Response Content = {}\nStatus Code = {}".format(response.content, response.status_code))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement