diff --git a/ariadne/asgi/handlers/http.py b/ariadne/asgi/handlers/http.py index 8d261f60..9432fecc 100644 --- a/ariadne/asgi/handlers/http.py +++ b/ariadne/asgi/handlers/http.py @@ -93,13 +93,13 @@ async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: response = await self.handle_request(request) await response(scope, receive, send) - async def handle_request_override(self, request: Request) -> Optional[Response]: + async def handle_request_override(self, _: Request) -> Optional[Response]: """Override the default request handling logic in subclasses. Is called in the `handle_request` method before the default logic. If None is returned, the default logic is executed. # Required arguments: - `request`: the `Request` instance from Starlette or FastAPI. + `_`: the `Request` instance from Starlette or FastAPI. """ return None diff --git a/ariadne/contrib/sse.py b/ariadne/contrib/sse.py index e6b4be0c..cbc5e506 100644 --- a/ariadne/contrib/sse.py +++ b/ariadne/contrib/sse.py @@ -209,7 +209,8 @@ async def _ping(self, send: Send) -> None: await send( { "type": "http.response.body", - # always encode as utf-8 as per https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model + # always encode as utf-8 as per + # https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model "body": ":\r\n\r\n".encode("utf-8"), "more_body": True, } @@ -276,15 +277,17 @@ def encode_event(event: GraphQLServerSentEvent) -> bytes: # Required arguments `event`: the GraphQLServerSentEvent object """ - # always encode as utf-8 as per https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model + # always encode as utf-8 as per + # https://html.spec.whatwg.org/multipage/server-sent-events.html#sse-processing-model return str(event).encode("utf-8") class GraphQLHTTPSSEHandler(GraphQLHTTPHandler): """Extension to the default GraphQLHTTPHandler to also handle Server-Sent Events as per - the GraphQL SSE Protocol specification. This handler only supports the defined `Distinct connections mode` - due to its statelessness. This implementation is based on the specification as of commit - 80cf75b5952d1a065c95bdbd6a74304c90dbe2c5. For more information see the specification + the GraphQL SSE Protocol specification. This handler only supports the defined + `Distinct connections mode` due to its statelessness. This implementation is based on + the specification as of commit 80cf75b5952d1a065c95bdbd6a74304c90dbe2c5. + For more information see the specification (https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md) """ diff --git a/tests/asgi/test_sse.py b/tests/asgi/test_sse.py index ad7ed216..05a67257 100644 --- a/tests/asgi/test_sse.py +++ b/tests/asgi/test_sse.py @@ -179,7 +179,7 @@ def test_ping_is_send_sse(sse_client): def test_custom_ping_interval(schema): app = GraphQL( schema, - http_handler=GraphQLHTTPSSEHandler(ping_interval=10), + http_handler=GraphQLHTTPSSEHandler(ping_interval=8), introspection=False, ) sse_client = TestClient(app, headers=SSE_HEADER) diff --git a/tests_integrations/fastapi/requirements.txt b/tests_integrations/fastapi/requirements.txt index b039b774..3524c884 100644 --- a/tests_integrations/fastapi/requirements.txt +++ b/tests_integrations/fastapi/requirements.txt @@ -1,27 +1,30 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.10 # by the following command: # # pip-compile --output-file=requirements.txt requirements.in # -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==3.7.1 +anyio==4.5.2 # via starlette -fastapi==0.109.1 +exceptiongroup==1.2.2 + # via anyio +fastapi==0.115.6 # via -r requirements.in -idna==3.7 +idna==3.10 # via anyio -pydantic==2.4.2 +pydantic==2.10.3 # via fastapi -pydantic-core==2.10.1 +pydantic-core==2.27.1 # via pydantic -sniffio==1.3.0 +sniffio==1.3.1 # via anyio -starlette==0.35.1 +starlette==0.41.3 # via fastapi -typing-extensions==4.8.0 +typing-extensions==4.12.2 # via + # anyio # fastapi # pydantic # pydantic-core