EndUpload V2

end_upload_v2(public_api_client, uuid, upload_id, etag_updated_parts)
Expand source code
end_upload_v2(public_api_client, uuid, upload_id, etag_updated_parts):
"""
Description
-----------
To finish artifacts upload.
Args
----
public_api_client: QDC api client object.
uuid: uuid of the initiated start upload request.
upload_id: id of pregisned url upload, returned by start_upload_v2.
etag_updated_parts: parts that eTags updated for multipart upload.
Returns
-------
end_upload_response_parsed: object with uuid, artifact_type, filename, upload_status
Usages
------
file_path = "C:\\Temp\\test.apk"
file_size = get_file_size(file_path)
file_name = get_filename(file_path)
start_upload_response = start_upload_v2(public_api_client, file_name, file_size, artifact_type)
parts = continue_upload_v2(file_path, start_upload_response.is_multipart_upload, start_upload_response.parts)
end_upload_response = end_upload_v2(public_api_client, start_upload_response.uuid, start_upload_response.upload_id, parts)
"""
end_upload_response = post_artifacts_presigned_uuid_endupload.sync_detailed(
client=public_api_client,
uuid=uuid,
body=CompleteMultipartPreSignedUrlsUploadType0(
upload_id=upload_id,
parts=etag_updated_parts
))
if end_upload_response.status_code == 200:
print(f"Complete upload response: {end_upload_response.content.decode('utf-8')}")
return end_upload_response.parsed
else:
raise Exception(f"Upload artifact failed with error code {end_upload_response.status_code} {end_upload_response.content.decode('utf-8')}")

Description

To finish artifacts upload.

Arguments

  • public_api_client: QDC api client object.
  • uuid: uuid of the initiated start upload request.
  • upload_id: id of pregisned url upload, returned by start_upload_v2.
  • etag_updated_parts: parts that eTags updated for multipart upload.

Returns

  • true: If the upload is finished.
  • false: If failed to finish the upload.

Usages

file_path = "C:\\Temp\\test.apk"
file_size = get_file_size(file_path)
file_name = get_filename(file_path)
start_upload_response = start_upload_v2(public_api_client, file_name, file_size, artifact_type)
parts = continue_upload_v2(file_path, start_upload_response.is_multipart_upload, start_upload_response.parts)
end_upload_response = end_upload_v2(public_api_client, start_upload_response.uuid, start_upload_response.upload_id, parts)