StartUpload V2

start_upload_v2(public_api_client, file_name, file_size, artifact_type)
Expand source code
start_upload_v2(public_api_client, file_name, file_size, artifact_type):
"""
Description
-----------
To initiate upload of artifacts by presigned urls.
Args
----
public_api_client: QDC api client object.
file_name: Name of the artifact to be uploaded.
artifact_type: Type of the artifact (TESTPACKAGE, TESTSCRIPT).
file_size: size of artifact in bytes.
Returns
-------
start_upload_response_parsed: object with uuid, upload_id, is_multipart_upload, presigned_url_parts
Usages
------
file_path = "C:\\Temp\\test.apk"
file_size = get_file_size(file_path)
file_name = get_filename(file_path)
artifact_type = ArtifactType.TESTPACKAGE
start_upload_response = start_upload_v2(public_api_client, file_name, file_size, artifact_type)
"""
start_upload_response = post_artifacts_presigned_startupload.sync_detailed(
client=public_api_client,
filename=file_name,
artifact_type=artifact_type,
file_size=file_size,
part_size=CHUNK_SIZE
)
if start_upload_response.status_code == 200:
print(f"start upload response: {start_upload_response.content.decode('utf-8')}")
return start_upload_response.parsed
else:
raise Exception(f"upload artifact failed with error code {start_upload_response.status_code} {start_upload_response.content.decode('utf-8')}")

Description

To initiate upload of artifacts by presigned urls.

Arguments

  • public_api_client: QDC api client object.
  • file_name: Name of the artifact to be uploaded.
  • artifact_type: Type of the artifact (TESTPACKAGE, TESTSCRIPT).
  • file_size: size of artifact in bytes.

Returns

  • start_upload_response_parsed: object with uuid, upload_id, is_multipart_upload, presigned_url_parts

Usages

file_path = "C:\\Temp\\test.apk"
file_size = get_file_size(file_path)
file_name = get_filename(file_path)
artifact_type = ArtifactType.TESTPACKAGE
start_upload_response = start_upload_v2(public_api_client, file_name, file_size, artifact_type)