#NEWLINE# def morph_action_hook( self , action ) : #NEWLINE# #INDENT# '\n        Update action to correct request path.\n\n        In many places, the Google API returns a full URL to a resource.\n        This will strip the scheme and host off of the path and just return\n        the request.  Otherwise, it will prepend the base request_path to\n        the action.\n\n        :param  action: The action to be called in the http request\n        :type   action: ``str``\n\n        :return:  The modified request based on the action\n        :rtype:   ``str``\n        ' #NEWLINE# if action . startswith ( 'https://' ) : #NEWLINE# #INDENT# u = urlparse . urlsplit ( action ) #NEWLINE# request = urlparse . urlunsplit ( ( '' , '' , u [ 2 ] , u [ 3 ] , u [ 4 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# request = ( self . request_path + action ) #NEWLINE# #UNINDENT# return request