#NEWLINE# def get_request_url( self , request_id ) : #NEWLINE# #INDENT# "Returns the URL the request e.g. 'http://localhost:8080/foo?bar=baz'.\n\n    Args:\n      request_id: The string id of the request making the API call.\n\n    Returns:\n      The URL of the request as a string.\n    " #NEWLINE# try : #NEWLINE# #INDENT# host = os . environ [ 'HTTP_HOST' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# host = os . environ [ 'SERVER_NAME' ] #NEWLINE# port = os . environ [ 'SERVER_PORT' ] #NEWLINE# if ( port != '80' ) : #NEWLINE# #INDENT# host += ( ':' + request_id ) #NEWLINE# #UNINDENT# #UNINDENT# url = ( 'http://' + host ) #NEWLINE# url += urllib . quote ( os . environ . get ( 'PATH_INFO' , '/' ) ) #NEWLINE# if os . environ . get ( 'QUERY_STRING' ) : #NEWLINE# #INDENT# url += ( '?' + os . environ [ 'QUERY_STRING' ] ) #NEWLINE# #UNINDENT# return url