def _put_meta_backblaze(storage_method, application_key): if not (application_key and storage_method.bucket_name != '0' and storage_method.account_id != '0'): raise exc.OioException("The client is missing backblaze parameters") meta = {} meta['backblaze.account_id'] = storage_method.account_id meta['backblaze.application_key'] = application_key meta['bucket_name'] = storage_method.bucket_name backblaze = Backblaze(storage_method.account_id, application_key) meta['authorization'] = backblaze.authorization_token meta['uploadToken'] = backblaze._get_upload_token_by_bucket_name( storage_method.bucket_name) return meta
def _put_meta_backblaze(self, storage_method, application_key): if not (application_key and storage_method.bucket_name and storage_method.account_id): raise exc.ClientException("missing some backblaze parameters " + "(bucket_name=%s, account_id=%s)" % (storage_method.bucket_name, storage_method.account_id)) meta = {} meta['backblaze.account_id'] = storage_method.account_id meta['backblaze.application_key'] = application_key meta['bucket_name'] = storage_method.bucket_name backblaze = Backblaze(storage_method.account_id, application_key) meta['authorization'] = backblaze.authorization_token meta['uploadToken'] = backblaze._get_upload_token_by_bucket_name( storage_method.bucket_name) return meta