parameters: (cls, message)
return_statement: return cls(headers)
docstring: Read headers from a Python 2 httplib message object.
docstring_summary: Read headers from a Python 2 httplib message object.
docstring_tokens: Read headers from a Python 2 httplib message object .
function: def from_httplib(cls, message):  # Python 2
          """Read headers from a Python 2 httplib message object."""
          # python2.7 does not expose a proper API for exporting multiheaders
          # efficiently. This function re-reads raw lines from the message
          # object and extracts the multiheaders properly.
          obs_fold_continued_leaders = (" ", "\t")
          headers = []
  
          for line in message.headers:
              if line.startswith(obs_fold_continued_leaders):
                  if not headers:
                      # We received a header line that starts with OWS as described
                      # in RFC-7230 S3.2.4. This indicates a multiline header, but
                      # there exists no previous header to which we can attach it.
                      raise InvalidHeader(
                          "Header continuation with no previous header: %s" % line
                      )
                  else:
                      key, value = headers[-1]
                      headers[-1] = (key, value + " " + line.strip())
                      continue
  
              key, value = line.split(":", 1)
              headers.append((key, value.strip()))
  
          return cls(headers)
function_tokens: def from_httplib ( cls , message ) : # Python 2 # python2.7 does not expose a proper API for exporting multiheaders # efficiently. This function re-reads raw lines from the message # object and extracts the multiheaders properly. obs_fold_continued_leaders = ( " " , "\t" ) headers = [ ] for line in message . headers : if line . startswith ( obs_fold_continued_leaders ) : if not headers : # We received a header line that starts with OWS as described # in RFC-7230 S3.2.4. This indicates a multiline header, but # there exists no previous header to which we can attach it. raise InvalidHeader ( "Header continuation with no previous header: %s" % line ) else : key , value = headers [ - 1 ] headers [ - 1 ] = ( key , value + " " + line . strip ( ) ) continue key , value = line . split ( ":" , 1 ) headers . append ( ( key , value . strip ( ) ) ) return cls ( headers )