#NEWLINE# def download_url( self , timeout = 60 , name = None ) : #NEWLINE# #INDENT# '\n        Trigger a browse download\n        :param timeout: int - Time in seconds to expire the download\n        :param name: str - for LOCAL only, to rename the file being downloaded\n        :return: str\n        ' #NEWLINE# if ( 'local' in self . driver . name . lower ( ) ) : #NEWLINE# #INDENT# return url_for ( SERVER_ENDPOINT , object_name = self . name , dl = 1 , name = name , _external = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# driver_name = self . driver . name . lower ( ) #NEWLINE# expires = ( datetime . datetime . now ( ) + datetime . timedelta ( seconds = timeout ) ) . strftime ( '%s' ) #NEWLINE# if ( ( 's3' in driver_name ) or ( 'google' in driver_name ) ) : #NEWLINE# #INDENT# s2s = 'GET\n\n\n{expires}\n/{object_name}' . format ( expires = expires , object_name = self . path ) #NEWLINE# h = hmac . new ( self . driver . secret , s2s , hashlib . sha1 ) #NEWLINE# s = base64 . encodestring ( h . digest ( ) ) . strip ( ) #NEWLINE# _keyIdName = ( 'AWSAccessKeyId' if ( 's3' in driver_name ) else 'GoogleAccessId' ) #NEWLINE# params = { #NEWLINE# #INDENT# _keyIdName : self . driver . key , #NEWLINE# 'Expires' : expires , #NEWLINE# 'Signature' : s , #NEWLINE# #UNINDENT# } #NEWLINE# urlkv = urlencode ( params ) #NEWLINE# return ( '%s?%s' % ( self . secure_url , urlkv ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'cloudfiles' in driver_name ) : #NEWLINE# #INDENT# return self . driver . ex_get_object_temp_url ( self . _obj , method = 'GET' , timeout = expires ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise NotImplemented ( ( "This provider '%s' doesn't support or doesn't have a signed url implemented yet" % self . provider_name ) )