Apache Libcloud is a Python package that allows you to manage cloud resources through an easy to use API within your Python program.
Read below to learn how to use Apache Libcloud with Filebase.
Use the following Python code to connect the Apache Libcloud connector to Filebase:
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
from libcloud.storage.base import StorageDriver
FILE_PATH = '/path/to/file/to/upload'
cls = get_driver(Provider.S3)
driver = cls('your_filebase_access_key', 'your_filebase_secret_key',host='s3.filebase.com')
container = driver.get_container(container_name='libcloud')
extra = {'meta_data': {'datafield_1': 'field_1', 'datafield_2': 'field_2'}}
with open(FILE_PATH, 'rb') as iterator:
obj = driver.upload_object_via_stream(iterator=iterator,
container=container,
object_name='backup.tar.gz',
extra=extra)