The documentation states creating containers but no API has been explained as to how one can download and upload a file, single file not a bunch of them. The language I am looking for is Python3.
Asked
Active
Viewed 399 times
1 Answers
0
You can try this code which works for me to upload to S3.
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
FILE_PATH = 'test.txt'
cls = get_driver(Provider.S3)
driver = cls('api key', 'api secret key')
container = driver.get_container(container_name='testing-bucket')
extra = {'meta_data': {'owner': 'shakeel', 'created': '2014-02-2'}}
with open(FILE_PATH, 'rb') as iterator:
obj = driver.upload_object_via_stream(iterator=iterator,
container=container,
object_name='test.txt',
extra=extra)
source: https://libcloud.readthedocs.io/en/latest/storage/examples.html

Shakeel
- 1,869
- 15
- 23
-
Can you give one example of downloading and uploading w/o streaming? – aviral sanjay Jan 31 '19 at 14:02
-
You can try using ```driver.upload_object()```. – Shakeel Feb 01 '19 at 06:51