Upload with Python-Swiftclient

Discover the power of Python-Swiftclient to seamlessly manage your UCDN storage containers.

With this versatile tool, you can list containers, list objects in a container, fetch account information, upload, download, and delete resources with ease.

Prerequisites

Before you embark on this journey, ensure the following:

  • You have an active UCDN account.
  • You’ve created at least one storage container from the UCDN Control Panel under the ‘Storage’ section.
  • You’ve installed the Python-Swiftclient according to the instructions provided here.

Authentication Parameters

Familiarize yourself with the required parameters for authentication. Here’s an example prompt:

swift COMMAND --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password  YOUR_PASSWORD  --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3

In the Object Storage service (Swift) architecture, your FTP username comprises two authentication parts (OpenStack Swift username and Tenant) separated by a dot (.) character.
Example FTP username: 1013031.1013031 ( --os-username.--os-tenant-name )
--os-password – Represents your FTP password.
--os-auth-url – Specifies the Swift authorization URL.


Depending on the location of your storage, you should use one of the following authorization URLs:
For Europe storage:
https://auth.files.nl01.cloud.servers.com:5000/v3 --auth-version 3
For North American storage:
https://auth.files.us01.cloud.servers.com:5000/v3 --auth-version 3


Important! The authentication version ( --auth-version 3 ) must be specified for successful authentication.

Examples of Python-Swiftclient Commands:

Using the command stat for fetching account information:

swift stat --verbose --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth version 3

Using the command list for listing the containers for the account or the objects for a container.

swift list --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3

Listing storage containers:

swift list --verbose --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3

Listing objects for a container:

swift list YOUR_CONTAINER_NAME --verbose --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3

Using the command upload for uploading files to a container.

swift upload YOUR_CONTAINER_NAME PATH_TO_YOUR_FILE --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3

Using the command download for downloading objects from a container.

swift download YOUR_CONTAINER_NAME OBJECT_NAME --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3

Using the command delete for deleting objects from a container.

swift delete YOUR_CONTAINER_NAME OBJECT_NAME --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url https://auth.files.XX01.cloud.servers.com:5000/v3 --auth-version 3


For additional information on the Python-Swiftclient commands read the swift – Man page or read the Documentation from the below sources:

https://platform.swiftstack.com/docs/integration/python-swiftclient.html#install-swift-clc-ref-label
https://docs.openstack.org/python-swiftclient/latest/cli/index.html


IMPORTANT!Please note that the storage containers must be created only from the Universal CDN Control Panel. Storage containers created not from the Control Panel will be rejected by the CDN system.



FTP Upload

Upload Large Files with Python-Swiftclient
Upload Through OpenStack Swift API
Upload with Rclone