codekingpro/portable-devtools
114k
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 generic3# implementation of HTTP/2 (and in particular the h2.connection.H2Connection4# class). There's still a bunch of subtle details you need to get right if you5# want to make this actually useful, because it doesn't implement all the6# 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 9from h11._connection import Connection, NEED_DATA, PAUSED10from h11._events import (11 ConnectionClosed,12 Data,13 EndOfMessage,14 Event,15 InformationalResponse,16 Request,17 Response,18)19from 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)32from h11._util import LocalProtocolError, ProtocolError, RemoteProtocolError33from h11._version import __version__34 35PRODUCT_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 