Format: text/x-python
⬇ Download File (1.1 KB)
   1  from .connection import HTTPConnection
   2  from .connection_pool import ConnectionPool
   3  from .http11 import HTTP11Connection
   4  from .http_proxy import HTTPProxy
   5  from .interfaces import ConnectionInterface
   6  
   7  try:
   8      from .http2 import HTTP2Connection
   9  except ImportError:  # pragma: nocover
  10  
  11      class HTTP2Connection:  # type: ignore
  12          def __init__(self, *args, **kwargs) -> None:  # type: ignore
  13              raise RuntimeError(
  14                  "Attempted to use http2 support, but the `h2` package is not "
  15                  "installed. Use 'pip install httpcore[http2]'."
  16              )
  17  
  18  
  19  try:
  20      from .socks_proxy import SOCKSProxy
  21  except ImportError:  # pragma: nocover
  22  
  23      class SOCKSProxy:  # type: ignore
  24          def __init__(self, *args, **kwargs) -> None:  # type: ignore
  25              raise RuntimeError(
  26                  "Attempted to use SOCKS support, but the `socksio` package is not "
  27                  "installed. Use 'pip install httpcore[socks]'."
  28              )
  29  
  30  
  31  __all__ = [
  32      "HTTPConnection",
  33      "ConnectionPool",
  34      "HTTPProxy",
  35      "HTTP11Connection",
  36      "HTTP2Connection",
  37      "ConnectionInterface",
  38      "SOCKSProxy",
  39  ]
  40