Object Storage

Accessing Object Storage via the command line

What is Swift client

The Swift client is a Python client to access Swift (Object Storage) API. It has two components: a Python API (the swiftclient module) for accessing Swift programmatically and a command-line script (swift).

You can find more information from the Python Swift client website.


We assume you use Ubuntu 19.04 and python3 to install the Swift Python client.

sudo apt update
sudo apt install python3-swiftclient

Set up Login Credentials

Before you can start, you need to setup the login details.

You can do this through our CLI tutorial here.

Command Line Interface (CLI)

After you have sourced your authentication file, you can type the below command to get all available options for the swift command:

swift --help

The below lists all containers in your project:

swift list

To find more information about how to use the Swift CLI, please see the python-swiftclient CLI website.

Python Code

Besides using the CLI, you can also write Python code to access containers. In this section we present some simple code examples that demonstrate the usage of the python-swiftclient API. You can find full details of the options and methods available to the API at the python-swiftclient project website.

List the available containers:

import swiftclient

user = username
key = password
auth_url = 'https://keystone.rc.nectar.org.au:5000/v3/'
auth_version = '3'
os_options = {
    'project_name': project_name

conn = swiftclient.Connection(user=user,key=key,os_options=os_options, auth_version=auth_version,authurl=auth_url)

containers = conn.get_account()

for container in containers:

Create a new container:

container = 'new-container'
containers = conn.get_account()
if container in containers: