Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_asset(metadata, file_name):
- credentials = '{username}:{password}'.format(username=conf['username'], password=conf['password'])
- auth_value = b64encode(credentials.encode())
- headers = {
- 'Authorization': '{type} {auth_value}'.format(type="Basic", auth_value=auth_value.decode()),
- 'Content-Type': 'application/json'
- }
- request_url = conf['artifact_endpoint']
- response = requests.post(request_url, data=metadata, headers=headers, verify=False)
- if not response.ok:
- print("Error while creating the asset {}".format(file_name))
- else:
- print("Response Content = {}\nStatus Code = {}".format(response.content, response.status_code))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement