Package restkit :: Module parser :: Class Parser
[hide private]
[frames] | no frames]

Class Parser

source code

object --+
         |
        Parser

HTTP Parser compatible 1.0 & 1.1 This parser can parse HTTP requests and response.

Instance Methods [hide private]
 
__init__(self, ptype='response', should_close=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
filter_headers(self, headers, buf)
take a string as buffer and an header dict (empty or not).
source code
 
finalize_headers(self, headers, headers_str, buf2)
parse the headers
source code
 
_parse_version(self, version) source code
 
_first_line(self, line)
parse first line
source code
 
_parse_headerl(self, hdrs, line)
parse header line
source code
 
body_eof(self)
do we have all the body ?
source code
 
read_chunk(self, buf) source code
 
trailing_header(self, buf) source code
 
filter_body(self, buf)
Filter body and return a tuple: (body_chunk, new_buffer) Both can be None, and new_buffer is always None if its empty.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
parse_response(cls, should_close=False)
Return parser object for response
source code
 
parse_request(cls)
return parser object for requests
source code
Properties [hide private]
  should_close
  is_chunked
is TE: chunked ?
  content_len
return content length as integer or None.

Inherited from object: __class__

Method Details [hide private]

__init__(self, ptype='response', should_close=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

filter_headers(self, headers, buf)

source code 

take a string as buffer and an header dict (empty or not). It return new position or -1 if parsing isn't done. headers dict is updated with new headers.


Property Details [hide private]

should_close

Get Method:
unreachable.should_close(self)

is_chunked

is TE: chunked ?

Get Method:
unreachable.is_chunked(self) - is TE: chunked ?

content_len

return content length as integer or None.

Get Method:
unreachable.content_len(self) - return content length as integer or None.