def parse_header_links(value):
 links = []
 replace_chars = ' \'"'
 for val in re.split(', *<', value):
  try:
   (url, params) = val.split(';', 1)
  except ValueError:
   (url, params) = (val, '')
  link = {'url': url.strip('<> \'"')}
  for param in params.split(';'):
   try:
    (key, value) = param.split('=')
   except ValueError:
    break
   link[key.strip(replace_chars)] = value.strip(replace_chars)
  links.append(link)
 return links

def parse_header_links ( value ) : links = [ ] replace_chars = ' \'"' for val in re . split ( ', *<' , value ) : try : ( url , params ) = val . split ( ';' , 1 ) except ValueError : ( url , params ) = ( val , '' ) link = { 'url' : url . strip ( '<> \'"' ) } for param in params . split ( ';' ) : try : ( key , value ) = param . split ( '=' ) except ValueError : break link [ key . strip ( replace_chars ) ] = value . strip ( replace_chars ) links . append ( link ) return links
return a dict of parsed link headers proxies .