#NEWLINE# def ex_get_object_temp_url( self , obj , method = 'GET' , timeout = 60 ) : #NEWLINE# #INDENT# "\n        Create a temporary URL to allow others to retrieve or put objects\n        in your Cloud Files account for as long or as short a time as you\n        wish.  This method is specifically for allowing users to retrieve\n        or update an object.\n\n        :param obj: The object that you wish to make temporarily public\n        :type obj: :class:`Object`\n\n        :param method: Which method you would like to allow, 'PUT' or 'GET'\n        :type method: ``str``\n\n        :param timeout: Time (in seconds) after which you want the TempURL\n        to expire.\n        :type timeout: ``int``\n\n        :rtype: ``bool``\n        " #NEWLINE# self . connection . _populate_hosts_and_request_paths ( ) #NEWLINE# expires = int ( ( time ( ) + timeout ) ) #NEWLINE# path = ( '%s/%s/%s' % ( self . connection . request_path , obj . container . name , obj . name ) ) #NEWLINE# try : #NEWLINE# #INDENT# key = self . ex_get_meta_data ( ) [ 'temp_url_key' ] #NEWLINE# assert ( key is not None ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# raise KeyError ( ( ( ( ( 'You must first set the ' + 'X-Account-Meta-Temp-URL-Key header on your ' ) + 'Cloud Files account using ' ) + 'ex_set_account_metadata_temp_url_key before ' ) + 'you can use this method.' ) ) #NEWLINE# #UNINDENT# hmac_body = ( '%s\n%s\n%s' % ( method , expires , path ) ) #NEWLINE# sig = hmac . new ( b ( key ) , b ( hmac_body ) , sha1 ) . hexdigest ( ) #NEWLINE# params = urlencode ( { #NEWLINE# #INDENT# 'temp_url_sig' : sig , #NEWLINE# 'temp_url_expires' : expires , #NEWLINE# #UNINDENT# } ) #NEWLINE# temp_url = ( 'https://%s/%s/%s?%s' % ( ( temp_url . connection . host + self . connection . request_path ) , obj . container . name , obj . name , params ) ) #NEWLINE# return temp_url