Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.