Skip to content

Commit 9a4e2bb

Browse files
committed
Support new httpx2 dependencies. Using httpx2 instead of httpx as default for the all dependency.
1 parent b6cfef7 commit 9a4e2bb

7 files changed

Lines changed: 14 additions & 7 deletions

File tree

docs/intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The corresponding between extra dependencies required and the GQL classes is:
5151
+---------------------+------------------------------------------------------------------+
5252
| requests | :ref:`RequestsHTTPTransport <requests_transport>` |
5353
+---------------------+------------------------------------------------------------------+
54-
| httpx | :ref:`HTTPTXTransport <httpx_transport>` |
54+
| httpx2 or httpx | :ref:`HTTPTXTransport <httpx_transport>` |
5555
| | |
5656
| | :ref:`HTTPXAsyncTransport <httpx_async_transport>` |
5757
+---------------------+------------------------------------------------------------------+

docs/transports/httpx.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
HTTPXTransport
44
==============
55

6-
The HTTPXTransport is a sync transport using the `httpx`_ library
6+
The HTTPXTransport is a sync transport using the `httpx2`_ or `httpx`_ library
77
and allows you to send GraphQL queries using the HTTP protocol.
88

99
Reference: :class:`gql.transport.httpx.HTTPXTransport`
1010

1111
.. literalinclude:: ../code_examples/httpx_sync.py
1212

1313
.. _httpx: https://www.python-httpx.org
14+
.. _httpx2: https://httpx2.pydantic.dev

docs/transports/httpx_async.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
HTTPXAsyncTransport
44
===================
55

6-
This transport uses the `httpx`_ library and allows you to send GraphQL queries using the HTTP protocol.
6+
This transport uses the `httpx2`_ or `httpx`_ library and allows you to send GraphQL queries using the HTTP protocol.
77

88
Reference: :class:`gql.transport.httpx.HTTPXAsyncTransport`
99

@@ -37,3 +37,4 @@ You can manually set the cookies which will be sent with each connection:
3737
transport = HTTPXAsyncTransport(url=url, cookies={"cookie1": "val1"})
3838
3939
.. _httpx: https://www.python-httpx.org
40+
.. _httpx2: https://httpx2.pydantic.dev

gql/transport/httpx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
try:
1818
import httpx2 as httpx
1919
except ModuleNotFoundError: # pragma: no cover
20-
import httpx
20+
import httpx # type: ignore[no-redef]
2121

2222
from graphql import ExecutionResult
2323

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
"httpx>=0.27.0,<1",
5353
]
5454

55+
install_httpx2_requires = [
56+
"httpx2>=2.0.0,<3",
57+
]
58+
5559
install_websockets_requires = [
5660
"websockets>=14.2,<16",
5761
]
@@ -65,7 +69,7 @@
6569
]
6670

6771
install_all_requires = (
68-
install_aiohttp_requires + install_requests_requires + install_httpx_requires + install_websockets_requires + install_botocore_requires + install_aiofiles_requires
72+
install_aiohttp_requires + install_requests_requires + install_httpx2_requires + install_websockets_requires + install_botocore_requires + install_aiofiles_requires
6973
)
7074

7175
# Get version from __version__.py file
@@ -110,6 +114,7 @@
110114
"aiohttp": install_aiohttp_requires,
111115
"requests": install_requests_requires,
112116
"httpx": install_httpx_requires,
117+
"httpx2": install_httpx2_requires,
113118
"websockets": install_websockets_requires,
114119
"botocore": install_botocore_requires,
115120
"aiofiles": install_aiofiles_requires,

tests/test_httpx_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ async def test_httpx_extra_args(aiohttp_server):
439439
try:
440440
import httpx2 as httpx
441441
except ModuleNotFoundError: # pragma: no cover
442-
import httpx
442+
import httpx # type: ignore[no-redef]
443443

444444
from aiohttp import web
445445

tests/test_httpx_batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ async def test_httpx_async_batch_extra_args(aiohttp_server):
328328
try:
329329
import httpx2 as httpx
330330
except ModuleNotFoundError: # pragma: no cover
331-
import httpx
331+
import httpx # type: ignore[no-redef]
332332

333333
from aiohttp import web
334334

0 commit comments

Comments
 (0)