pycohttpparser Python API¶
This page documents pycohttpparser’s Python API.
An important feature to note is that, wherever possible, pycohttpparser uses memoryview objects to avoid copying data. The only objects that are not returned as ``memoryview``s are response status codes and the HTTP minor version number.
- class pycohttpparser.api.Parser[source]¶
A single HTTP parser object. This object can parse HTTP requests and responses using picohttpparser.
This object is not thread-safe, and it does maintain state that is shared across parsing requests. For this reason, make sure that access to this object is synchronized if you use it across multiple threads.
- class pycohttpparser.api.Request¶
Request(method, path, minor_version, headers, consumed)
- consumed¶
Alias for field number 4
- count(value) → integer -- return number of occurrences of value¶
- headers¶
Alias for field number 3
- index(value[, start[, stop]]) → integer -- return first index of value.¶
Raises ValueError if the value is not present.
- method¶
Alias for field number 0
- minor_version¶
Alias for field number 2
- path¶
Alias for field number 1
- class pycohttpparser.api.Response¶
Response(status, msg, minor_version, headers, consumed)
- consumed¶
Alias for field number 4
- count(value) → integer -- return number of occurrences of value¶
- headers¶
Alias for field number 3
- index(value[, start[, stop]]) → integer -- return first index of value.¶
Raises ValueError if the value is not present.
- minor_version¶
Alias for field number 2
- msg¶
Alias for field number 1
- status¶
Alias for field number 0