1 # A highish-level implementation of the HTTP/1.1 wire protocol (RFC 7230), 2 # containing no networking code at all, loosely modelled on hyper-h2's generic 3 # implementation of HTTP/2 (and in particular the h2.connection.H2Connection 4 # class). There's still a bunch of subtle details you need to get right if you 5 # want to make this actually useful, because it doesn't implement all the 6 # semantics to check that what you're asking to write to the wire is sensible, 7 # but at least it gets you out of dealing with the wire itself. 8 9 from h11._connection import Connection, NEED_DATA, PAUSED 10 from h11._events import ( 11 ConnectionClosed, 12 Data, 13 EndOfMessage, 14 Event, 15 InformationalResponse, 16 Request, 17 Response, 18 ) 19 from h11._state import ( 20 CLIENT, 21 CLOSED, 22 DONE, 23 ERROR, 24 IDLE, 25 MIGHT_SWITCH_PROTOCOL, 26 MUST_CLOSE, 27 SEND_BODY, 28 SEND_RESPONSE, 29 SERVER, 30 SWITCHED_PROTOCOL, 31 ) 32 from h11._util import LocalProtocolError, ProtocolError, RemoteProtocolError 33 from h11._version import __version__ 34 35 PRODUCT_ID = "python-h11/" + __version__ 36 37 38 __all__ = ( 39 "Connection", 40 "NEED_DATA", 41 "PAUSED", 42 "ConnectionClosed", 43 "Data", 44 "EndOfMessage", 45 "Event", 46 "InformationalResponse", 47 "Request", 48 "Response", 49 "CLIENT", 50 "CLOSED", 51 "DONE", 52 "ERROR", 53 "IDLE", 54 "MUST_CLOSE", 55 "SEND_BODY", 56 "SEND_RESPONSE", 57 "SERVER", 58 "SWITCHED_PROTOCOL", 59 "ProtocolError", 60 "LocalProtocolError", 61 "RemoteProtocolError", 62 ) 63