#NEWLINE# def get_url( self , secure = False , longurl = False ) : #NEWLINE# #INDENT# '\n        Return the url \n        :param secure: bool - To use https\n        :param longurl: bool - On local, reference the local path with the domain\n                        ie: http://site.com/files/object.png otherwise /files/object.png\n        :return: str\n        ' #NEWLINE# driver_name = self . driver . name . lower ( ) #NEWLINE# try : #NEWLINE# #INDENT# url = self . _obj . get_cdn_url ( ) #NEWLINE# if ( 'local' in driver_name ) : #NEWLINE# #INDENT# url = url_for ( SERVER_ENDPOINT , object_name = self . name , _external = longurl ) #NEWLINE# #UNINDENT# #UNINDENT# except NotImplementedError as e : #NEWLINE# #INDENT# object_path = ( '%s/%s' % ( self . container . name , self . name ) ) #NEWLINE# if ( 's3' in driver_name ) : #NEWLINE# #INDENT# base_url = ( 'http://%s' % self . driver . connection . host ) #NEWLINE# url = urljoin ( base_url , object_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'google' in driver_name ) : #NEWLINE# #INDENT# url = urljoin ( 'http://storage.googleapis.com' , object_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'azure' in driver_name ) : #NEWLINE# #INDENT# base_url = ( 'http://%s.blob.core.windows.net' % self . driver . key ) #NEWLINE# url = urljoin ( base_url , object_path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise e #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if secure : #NEWLINE# #INDENT# if ( 'cloudfiles' in driver_name ) : #NEWLINE# #INDENT# parsed_url = urlparse ( url ) #NEWLINE# if ( parsed_url . scheme != 'http' ) : #NEWLINE# #INDENT# return url #NEWLINE# #UNINDENT# split_netloc = parsed_url . netloc . split ( '.' ) #NEWLINE# split_netloc [ 1 ] = 'ssl' #NEWLINE# url = urlunparse ( 'https' , '.' . join ( split_netloc ) , parsed_url . path , parsed_url . params , parsed_url . query , parsed_url . fragment ) #NEWLINE# #UNINDENT# if ( ( 's3' in driver_name ) or ( 'google' in driver_name ) or ( 'azure' in driver_name ) ) : #NEWLINE# #INDENT# url = url . replace ( 'http://' , 'https://' ) #NEWLINE# #UNINDENT# #UNINDENT# return url