@@ -66,13 +66,13 @@ def _get_channel_name (self):
66
66
return self .uuid
67
67
68
68
def _get_resource_path (self ):
69
- return '{}/{}' .format (self ._collection_path , self .uuid )
69
+ return '{0 }/{1 }' .format (self ._collection_path , self .uuid )
70
70
71
71
@classmethod
72
72
def get (cls , uuid , sdk ):
73
73
if not uuid or not isinstance (uuid , basestring ):
74
74
return None
75
- path = '{}/{}' .format (cls ._collection_path , uuid )
75
+ path = '{0 }/{1 }' .format (cls ._collection_path , uuid )
76
76
try :
77
77
remote_document = sdk .api .get (path )
78
78
except sdk .exceptions .ApiError as exception :
@@ -292,11 +292,11 @@ def value(self, value):
292
292
self .document ['value' ] = value
293
293
294
294
def _get_resource_path (self ):
295
- return '{}/{}/{}' .format (self ._collection_path , self .group , self .key )
295
+ return '{0 }/{1 }/{2 }' .format (self ._collection_path , self .group , self .key )
296
296
297
297
@classmethod
298
298
def get (cls , group , key , sdk ):
299
- path = '{}/{}/{}' .format (cls ._collection_path , group , key )
299
+ path = '{0 }/{1 }/{2 }' .format (cls ._collection_path , group , key )
300
300
try :
301
301
document = sdk .api .get (path )
302
302
except sdk .exceptions .ApiError as exception :
@@ -307,7 +307,7 @@ def get (cls, group, key, sdk):
307
307
308
308
@classmethod
309
309
def create (cls , group , key , value , sdk ):
310
- path = '{}/{}/{}' .format (cls ._collection_path , group , key )
310
+ path = '{0 }/{1 }/{2 }' .format (cls ._collection_path , group , key )
311
311
document = sdk .api .put (path , value )
312
312
data = cls (document , sdk )
313
313
return data
@@ -316,7 +316,7 @@ def save (self):
316
316
self ._document = self ._sdk .api .put (self ._get_resource_path (), self .value )
317
317
318
318
def _get_channel_name (self ):
319
- return 'data:{}:{}' .format (self .group , self .key )
319
+ return 'data:{0 }:{1 }' .format (self .group , self .key )
320
320
321
321
322
322
@@ -339,9 +339,9 @@ def get_children (self, params=None):
339
339
340
340
def _get_delivery_url (self ):
341
341
auth = self ._sdk .authenticator .get_auth ()
342
- base = '{}/api/delivery' .format (auth ['api' ]['host' ])
342
+ base = '{0 }/api/delivery' .format (auth ['api' ]['host' ])
343
343
encoded_path = urllib .quote (self .document .get ('path' ))
344
- return '{}/{}?_rt={}' .format (base , encoded_path , auth ['restrictedToken' ])
344
+ return '{0 }/{1 }?_rt={2 }' .format (base , encoded_path , auth ['restrictedToken' ])
345
345
346
346
def get_url (self ):
347
347
if self .subtype == 'scala:content:file' :
@@ -352,7 +352,7 @@ def get_url (self):
352
352
return self .document .get ('url' )
353
353
354
354
def get_variant_url (self , name ):
355
- return '{}&variant=' .format (self ._get_delivery_url (), name )
355
+ return '{0 }&variant=' .format (self ._get_delivery_url (), name )
356
356
357
357
def has_variant (self , name ):
358
358
return name in [variant ['name' ] for variant in self .document .get ('variants' , [])]
@@ -388,7 +388,7 @@ def _on_error(self, exception):
388
388
self ._sdk .logger .debug ('API call encountered an unexpected error: %s' % traceback .format_exc ())
389
389
raise self ._sdk .exceptions .UnexpectedError ('API call encountered an unexpected error.' )
390
390
else :
391
- raise self ._sdk .exceptions .ApiError (code = payload .get ('code' ), message = payload .get ('message' ), status_code = exception .response .status_code )
391
+ raise self ._sdk .exceptions .ApiError (code = payload .get ('code' ), message = payload .get ('message' ), status_code = exception .response .status_code , payload = payload )
392
392
else :
393
393
self ._sdk .logger .warn ('API call encountered an unexpected error.' )
394
394
self ._sdk .logger .debug ('API call encountered an unexpected error: %s' % traceback .format_exc ())
0 commit comments