/usr/share/pyshared/http_parser-0.8.3.egg-info/PKG-INFO is in python-http-parser 0.8.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | Metadata-Version: 1.1
Name: http-parser
Version: 0.8.3
Summary: http request/response parser
Home-page: http://github.com/benoitc/http-parser
Author: Benoit Chesneau
Author-email: benoitc@e-engura.com
License: MIT
Description: http-parser
-----------
HTTP request/response parser for Python compatible with Python 2.x
(>=2.6), Python 3 and Pypy. If possible a C parser based on
http-parser_ from Ryan Dahl will be used.
http-parser is under the MIT license.
Project url: https://github.com/benoitc/http-parser/
.. image::
https://secure.travis-ci.org/benoitc/http-parser.png?branch=master
:alt: Build Status
:target: https://travis-ci.org/benoitc/http-parser
Requirements:
-------------
- Python 2.6 or sup. Pypy latest version.
- Cython if you need to rebuild the C code (Not needed for Pypy)
Installation
------------
::
$ pip install http-parser
Or install from source::
$ git clone git://github.com/benoitc/http-parser.git
$ cd http-parser && python setup.py install
Note: if you get an error on MacOSX try to install with the following
arguments:
$ env ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install
Usage
-----
http-parser provide you **parser.HttpParser** low-level parser in C that
you can access in your python program and **http.HttpStream** providing
higher-level access to a readable,sequential io.RawIOBase object.
To help you in your day work, http-parser provides you 3 kind of readers
in the reader module: IterReader to read iterables, StringReader to
reads strings and StringIO objects, SocketReader to read sockets or
objects with the same api (recv_into needed). You can of course use any
io.RawIOBase object.
Example of HttpStream
+++++++++++++++++++++
ex::
#!/usr/bin/env python
import socket
from http_parser.http import HttpStream
from http_parser.reader import SocketReader
def main():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(('gunicorn.org', 80))
s.send("GET / HTTP/1.1\r\nHost: gunicorn.org\r\n\r\n")
r = SocketReader(s)
p = HttpStream(r)
print p.headers()
print p.body_file().read()
finally:
s.close()
if __name__ == "__main__":
main()
Example of HttpParser:
++++++++++++++++++++++
::
#!/usr/bin/env python
import socket
# try to import C parser then fallback in pure python parser.
try:
from http_parser.parser import HttpParser
except ImportError:
from http_parser.pyparser import HttpParser
def main():
p = HttpParser()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
body = []
try:
s.connect(('gunicorn.org', 80))
s.send("GET / HTTP/1.1\r\nHost: gunicorn.org\r\n\r\n")
while True:
data = s.recv(1024)
if not data:
break
recved = len(data)
nparsed = p.execute(data, recved)
assert nparsed == recved
if p.is_headers_complete():
print p.get_headers()
if p.is_partial_body():
body.append(p.recv_body())
if p.is_message_complete():
break
print "".join(body)
finally:
s.close()
if __name__ == "__main__":
main()
You can find more docs in the code (or use a doc generator).
Copyright
---------
2011-2013 (c) BenoƮt Chesneau <benoitc@e-engura.org>
.. http-parser_ https://github.com/ry/http-parser
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|