__init__.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. from h11._connection import Connection, NEED_DATA, PAUSED
  9. from h11._events import (
  10. ConnectionClosed,
  11. Data,
  12. EndOfMessage,
  13. Event,
  14. InformationalResponse,
  15. Request,
  16. Response,
  17. )
  18. from h11._state import (
  19. CLIENT,
  20. CLOSED,
  21. DONE,
  22. ERROR,
  23. IDLE,
  24. MIGHT_SWITCH_PROTOCOL,
  25. MUST_CLOSE,
  26. SEND_BODY,
  27. SEND_RESPONSE,
  28. SERVER,
  29. SWITCHED_PROTOCOL,
  30. )
  31. from h11._util import LocalProtocolError, ProtocolError, RemoteProtocolError
  32. from h11._version import __version__
  33. PRODUCT_ID = "python-h11/" + __version__
  34. __all__ = (
  35. "Connection",
  36. "NEED_DATA",
  37. "PAUSED",
  38. "ConnectionClosed",
  39. "Data",
  40. "EndOfMessage",
  41. "Event",
  42. "InformationalResponse",
  43. "Request",
  44. "Response",
  45. "CLIENT",
  46. "CLOSED",
  47. "DONE",
  48. "ERROR",
  49. "IDLE",
  50. "MUST_CLOSE",
  51. "SEND_BODY",
  52. "SEND_RESPONSE",
  53. "SERVER",
  54. "SWITCHED_PROTOCOL",
  55. "ProtocolError",
  56. "LocalProtocolError",
  57. "RemoteProtocolError",
  58. )