Skip to content

Commit abee287

Browse files
Fix import issues. Closes #426 (#428)
1 parent 22b980f commit abee287

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

httpcore/_async/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
try:
88
from .http2 import AsyncHTTP2Connection
99
except ImportError: # pragma: nocover
10-
pass
10+
11+
class AsyncHTTP2Connection: # 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+
)
1117

1218

1319
__all__ = [

httpcore/_sync/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
try:
88
from .http2 import HTTP2Connection
99
except ImportError: # pragma: nocover
10-
pass
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+
)
1117

1218

1319
__all__ = [

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ def get_packages(package):
5353
packages=get_packages("httpcore"),
5454
include_package_data=True,
5555
zip_safe=False,
56-
install_requires=["h11>=0.11,<0.13", "sniffio==1.*", "anyio==3.*"],
56+
install_requires=[
57+
"h11>=0.11,<0.13",
58+
"sniffio==1.*",
59+
"anyio==3.*",
60+
"certifi",
61+
],
5762
extras_require={
5863
"http2": ["h2>=3,<5"],
5964
},

0 commit comments

Comments
 (0)