Skip to content

Instantly share code, notes, and snippets.

@tobiasmcnulty
Last active July 7, 2022 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasmcnulty/ee053828bdf3e396df757c285efc8e8a to your computer and use it in GitHub Desktop.
Save tobiasmcnulty/ee053828bdf3e396df757c285efc8e8a to your computer and use it in GitHub Desktop.
How to download Rackspace Cloud Files containers
# I could not get python-swiftclient to obtain its own auth token from Rackspace directly for a non-default region.
# Instead, I obtain one with the swiftly client and then use the `swift` CLI to download the container.
pip install -U python-swiftclient swiftly
export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
export OS_USERNAME=...
export OS_REGION_NAME=IAD
# Set your API Key as the password, not your password...
export OS_PASSWORD=...
swiftly -A $OS_AUTH_URL -U $OS_USERNAME -K $OS_PASSWORD --region $OS_REGION_NAME auth
# Extract the "Storage URL" and "Auth Token" and define two more variables
export STORAGE_URL=...
export AUTH_TOKEN=...
# Make sure you see the buckets you expect
swift --os-storage-url $STORAGE_URL --os-auth-token $AUTH_TOKEN list
# Download all buckets in the region (or specify the bucket name instead of `--all` to download one)
swift --os-storage-url $STORAGE_URL --os-auth-token $AUTH_TOKEN download --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment