A pathlib-derived interface to Openstack Swift
Project description
🐉 Installation
Install from PyPI:
$ pip install swiftpath
🐉 About
Swift Connection
swiftpath will automatically read environment variables to determine how to connect to a swift instance.
Currently, swiftpath looks for the following environment variables when connecting to swift:
OS_USER_ID or OS_USERNAME
OS_PASSWORD
OS_PROJECT_NAME or OS_TENANT_NAME
OS_AUTH_URL or OS_AUTHENTICATION_URL
OS_STORAGE_URL
OS_REGION_NAME
OS_PROJECT_ID
Caveats
Note that the following methods are not provided as they are not available on swift:
SwiftPath.cwd()
SwiftPath.home()
SwiftPath.chmod()
SwiftPath.expanduser()
SwiftPath.lchmod()
SwiftPath.group()
SwiftPath.is_block_device()
SwiftPath.is_char_device()
SwiftPath.lstat()
SwiftPath.resolve()
🐉 Usage
To construct a path to a swift instance, simply use the syntax /containername/path/to/key when referencing the object. All pathlib.Path methods that are not explicitly excluded are available on the subsequently created object.
>>> from swiftpath import SwiftPath
>>> path = SwiftPath("/mycontainer/my-file.txt")
>>> path.write_text("hello\n")
>>> path.read_text()
hello
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for swiftpath-0.0.1.dev0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae7366e2cda95784c8ace70467060c8c04f614a7eb743ec6742f8cc4d5b3ba81 |
|
MD5 | 65ce452ab366056807f6c67f69ff3bf7 |
|
BLAKE2b-256 | 6605083c7c4336188fba5957d01f97afb2193142c8ec45f34abe273a3818efda |