Upload Packages in the Python Conda Environment

POST /api/v1.2/package/<envID>/upload_package

Use this API to upload egg or wheel packages in the Python Conda environment.

Note

This API is available in the new Package Management and is not enabled by default. Create a ticket with Qubole Support to enable this API.

Required Role

The following users can make this API call:

  • Users who belong to the system-user or system-admin group.

  • Users who belong to a group associated with a role that allows updating an environment. See Managing Groups and Managing Roles for more information.

Parameters

Note

Parameters marked in bold are mandatory. Others are optional and have default values.

Parameter

Description

source_type

Only Python can be uploaded currently. Specify python_package and it is mandatory while uploading packages through an environment.

upload_package _type

Type of package. Possible values:egg, wheel.

package_names

Specify the object storage path (for example, s3:: path) for the package.

file

Specify the local file path if you are uploading from a local storage.

Note

You should specify either package_names or file.

Request API Syntax

The following syntax shows how to upload if the package is on object storage path.

curl -X POST -H "X-AUTH-TOKEN:<API-TOKEN>“ -H "Content-Type: application/json" -H "Accept: application/json" -d
' {"source_type": “python_package“, "upload_package_type": “<egg/wheel>”, “package_names”: “s3://path/to/file”}’ \
"https://api.qubole.net/api/v1.2/package/<envId>/upload_package"

The following syntax shows how to upload if the package is on the local storage.

 curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: multipart/form-data" -H "Accept: application/json" \
-F "source_type"="python_package" -F  "upload_package_type"="<egg/wheel>"  -F  "file"="<local hard disk location>" \
 "https://api.qubole.com/api/v1.2/package/<envId>/upload_package"

Note

The above syntax uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.

Sample API Requests

The following sample API call shows how to upload egg from the object storage path.

curl -X POST -H "X-AUTH-TOKEN:<API-TOKEN>“ -H "Content-Type: application/json" -H "Accept: application/json" -d '
{"source_type": “python_package“, "upload_package_type": “egg”, “package_names”: “s3://path/to/egg/file”}’ \
"https://api.qubole.net/api/v1.2/package/100/upload_package"

The following sample API call shows how to upload wheel from the local storage.

curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: multipart/form-data" -H "Accept: application/json" \
-F "source_type"="python_package" -F  "upload_package_type”=“wheel”  -F  "file"="/usr/tmp/upload/package.whl" \
"https://api.qubole.com/api/v1.2/package/100/upload_package"