def _retrieve_location_from_ssdp(response):
 parsed_headers = re.findall('(?P<name>.*?): (?P<value>.*?)\\r\\n', response)
 header_locations = [header[1] for header in parsed_headers if (header[0].lower() == 'location')]
 if (len(header_locations) < 1):
  raise IGDError('IGD response does not contain a "location" header.')
 return urlparse(header_locations[0])

def _retrieve_location_from_ssdp ( response ) : parsed_headers = re . findall ( '(?P<name>.*?): (?P<value>.*?)\\r\\n' , response ) header_locations = [ header [ 1 ] for header in parsed_headers if ( header [ 0 ] . lower ( ) == 'location' ) ] if ( len ( header_locations ) < 1 ) : raise IGDError ( 'IGD response does not contain a "location" header.' ) return urlparse ( header_locations [ 0 ] )
parse raw http response to retrieve the upnp location header and return a parseresult object .