From 978fc43a82c8cb6ecd9ad8e0da8aad8704a90963 Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 29 Oct 2014 10:47:32 -0400 Subject: [PATCH] Started commenting CloudStorageUploader class --- .../cloud_storage_uploader.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py b/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py index 49c508527..84dbdc054 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/cloud_storage_uploader.py @@ -6,6 +6,15 @@ from libcloud.storage.providers import get_driver from libcloud.storage.types import Provider, ContainerDoesNotExistError, ObjectDoesNotExistError class CloudStorageUploader: + """ A class that uses Apache Libcloud's Storage API to upload objects into + various cloud storage backends. + + Attributes: + _provider: Storage backend. For exmaple, Amazon S3, Google Storage. + _bucket: Name of container on provider where files will get uploaded into. + _api_key: Access key to objects on the provider's storage backend. + _api_key_secret: Secret access key to objects on the provider's storage backend. +""" def __init__(self, provider, bucket, api_key, api_key_secret): self._provider = provider self._bucket = bucket @@ -13,6 +22,16 @@ class CloudStorageUploader: self._api_key_secret = api_key_secret def upload_obj(self, audio_file_path, metadata): + '''Uploads a file into a provider's cloud object storage. + + Generates a unique object name + + Keyword arguments: + audio_file_path: Path on disk to the audio file that is about to be + uploaded to cloud object storage. + metadata: ID3 tags and other metadata extracted from the audio file. + ''' + file_base_name = os.path.basename(audio_file_path) file_name, extension = os.path.splitext(file_base_name)