10000 Add sync batching to requests sync transport by itolosa · Pull Request #431 · graphql-python/gql · GitHub
[go: up one dir, main page]

Skip to content

Add sync batching to requests sync transport #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use relative imports when possible
  • Loading branch information
itolosa committed Sep 5, 2023
commit a2a711fd37dba571acc511fd9da3de8289761b4f
2 changes: 1 addition & 1 deletion gql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
validate,
)

from gql.graphql_request import GraphQLRequest
from .graphql_request import GraphQLRequest

from .transport.async_transport import AsyncTransport
from .transport.exceptions import TransportClosed, TransportQueryError
Expand Down
2 changes: 1 addition & 1 deletion gql/transport/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from requests.cookies import RequestsCookieJar
from requests_toolbelt.multipart.encoder import MultipartEncoder

from gql.graphql_request import GraphQLRequest
from ..graphql_request import GraphQLRequest
from gql.transport import Transport

from ..utils import extract_files
Expand Down
2 changes: 1 addition & 1 deletion gql/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from graphql import DocumentNode, ExecutionResult

from gql.graphql_request import GraphQLRequest
from ..graphql_request import GraphQLRequest


class Transport(abc.ABC):
Expand Down
3 changes: 1 addition & 2 deletions tests/custom_scalars/test_money.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
)
from graphql.utilities import value_from_ast_untyped

from gql import Client, gql
from gql.graphql_request import GraphQLRequest
from gql import Client, GraphQLRequest, gql
from gql.transport.exceptions import TransportQueryError
from gql.utilities import serialize_value, update_schema_scalar, update_schema_scalars

Expand Down
5 changes: 5 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class RandomTransport(Transport):
def execute(self):
super(RandomTransport, self).execute(http_transport_query)

def execute_batch(self):
super(RandomTransport, self).execute_batch(
[GraphQLRequest(document=http_transport_query)]
)

with pytest.raises(NotImplementedError) as exc_info:
RandomTransport().execute()
assert "Any Transport subclass must implement execute method" == str(exc_info.value)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_graphql_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
)
from graphql.utilities import value_from_ast_untyped

from gql import gql
from gql.graphql_request import GraphQLRequest
from gql import gql, GraphQLRequest

from .conftest import MS

Expand Down
3 changes: 1 addition & 2 deletions tests/test_transport_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import pytest

from gql import Client, gql
from gql.graphql_request import GraphQLRequest
from gql import Client, GraphQLRequest, gql

# We serve https://github.com/graphql-python/swapi-graphene locally:
URL = "http://127.0.0.1:8000/graphql"
Expand Down
0