strawberry-graphql 0.237.1__py3-none-any.whl → 0.237.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,7 @@ class ASGIRequestAdapter(AsyncHTTPRequestAdapter):
44
44
 
45
45
  @property
46
46
  def query_params(self) -> QueryParams:
47
- return dict(self.request.query_params)
47
+ return self.request.query_params
48
48
 
49
49
  @property
50
50
  def method(self) -> HTTPMethod:
@@ -117,12 +117,12 @@ class GraphQL(
117
117
  else:
118
118
  self.graphql_ide = graphql_ide
119
119
 
120
- async def __call__(self, scope: Request, receive: Receive, send: Send) -> None:
120
+ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
121
121
  if scope["type"] == "http":
122
- return await self.handle_http(scope, receive, send) # type: ignore
122
+ return await self.handle_http(scope, receive, send)
123
123
 
124
124
  elif scope["type"] == "websocket":
125
- ws = WebSocket(scope, receive=receive, send=send) # type: ignore
125
+ ws = WebSocket(scope, receive=receive, send=send)
126
126
  preferred_protocol = self.pick_preferred_protocol(ws)
127
127
 
128
128
  if preferred_protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
@@ -10,7 +10,6 @@ from typing import (
10
10
  Callable,
11
11
  Dict,
12
12
  List,
13
- Mapping,
14
13
  Optional,
15
14
  Sequence,
16
15
  Type,
@@ -33,19 +32,14 @@ from fastapi import APIRouter, Depends, params
33
32
  from fastapi.datastructures import Default
34
33
  from fastapi.routing import APIRoute
35
34
  from fastapi.utils import generate_unique_id
35
+ from strawberry.asgi import ASGIRequestAdapter
36
36
  from strawberry.exceptions import InvalidCustomContext
37
37
  from strawberry.fastapi.context import BaseContext, CustomContext
38
38
  from strawberry.fastapi.handlers import GraphQLTransportWSHandler, GraphQLWSHandler
39
- from strawberry.http import (
40
- process_result,
41
- )
42
- from strawberry.http.async_base_view import AsyncBaseHTTPView, AsyncHTTPRequestAdapter
39
+ from strawberry.http import process_result
40
+ from strawberry.http.async_base_view import AsyncBaseHTTPView
43
41
  from strawberry.http.exceptions import HTTPException
44
- from strawberry.http.types import FormData, HTTPMethod, QueryParams
45
- from strawberry.http.typevars import (
46
- Context,
47
- RootValue,
48
- )
42
+ from strawberry.http.typevars import Context, RootValue
49
43
  from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL
50
44
 
51
45
  if TYPE_CHECKING:
@@ -61,42 +55,13 @@ if TYPE_CHECKING:
61
55
  from strawberry.types import ExecutionResult
62
56
 
63
57
 
64
- class FastAPIRequestAdapter(AsyncHTTPRequestAdapter):
65
- def __init__(self, request: Request) -> None:
66
- self.request = request
67
-
68
- @property
69
- def query_params(self) -> QueryParams:
70
- return dict(self.request.query_params)
71
-
72
- @property
73
- def method(self) -> HTTPMethod:
74
- return cast(HTTPMethod, self.request.method.upper())
75
-
76
- @property
77
- def headers(self) -> Mapping[str, str]:
78
- return self.request.headers
79
-
80
- @property
81
- def content_type(self) -> Optional[str]:
82
- return self.request.headers.get("Content-Type", None)
83
-
84
- async def get_body(self) -> bytes:
85
- return await self.request.body()
86
-
87
- async def get_form_data(self) -> FormData:
88
- multipart_data = await self.request.form()
89
-
90
- return FormData(files=multipart_data, form=multipart_data)
91
-
92
-
93
58
  class GraphQLRouter(
94
59
  AsyncBaseHTTPView[Request, Response, Response, Context, RootValue], APIRouter
95
60
  ):
96
61
  graphql_ws_handler_class = GraphQLWSHandler
97
62
  graphql_transport_ws_handler_class = GraphQLTransportWSHandler
98
63
  allow_queries_via_get = True
99
- request_adapter_class = FastAPIRequestAdapter
64
+ request_adapter_class = ASGIRequestAdapter
100
65
 
101
66
  @staticmethod
102
67
  async def __get_root_value() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.237.1
3
+ Version: 0.237.3
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -8,7 +8,7 @@ strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuP
8
8
  strawberry/aiohttp/test/client.py,sha256=4vjTDxtNVfpa74GfUUO7efPI6Ssh1vzfCYp3tPA-SLk,1357
9
9
  strawberry/aiohttp/views.py,sha256=3Imc-kP01zhDYmWQRFcQyZsObqdELQ84d-3zFrpHNxA,6091
10
10
  strawberry/annotation.py,sha256=ftSxGZQUk4C5_5YRM_wNJFVVnZi0XOp71kD7zv4oxbU,13077
11
- strawberry/asgi/__init__.py,sha256=WEoF0LHx22ABKo0vmN6vQGRVEc0EDLzrqUH99trMqrg,7013
11
+ strawberry/asgi/__init__.py,sha256=37w7FeDEmfq2YXKeyyBgjTAliz9ut5Y0-0dVgfE-PAk,6973
12
12
  strawberry/asgi/handlers/__init__.py,sha256=rz5Gth2eJUn7tDq2--99KSNFeMdDPpLFCkfA7vge0cI,235
13
13
  strawberry/asgi/handlers/graphql_transport_ws_handler.py,sha256=_5N58XdtCZndU81ky1f5cwG9E4NhysxP4uHlqqZNzn4,2147
14
14
  strawberry/asgi/handlers/graphql_ws_handler.py,sha256=KQXmbk7uDwiG1yOadz65GsSzjAPUjKrpEQYAA94nGRM,2379
@@ -123,7 +123,7 @@ strawberry/fastapi/context.py,sha256=07991DShQoYMBVyQl9Mh5xvXQSNQI2RXT2ZQ5fWiga4
123
123
  strawberry/fastapi/handlers/__init__.py,sha256=TziBHyibYBOGiidjpCkjNThYbVY7K_nt0hnRLVHVh3I,241
124
124
  strawberry/fastapi/handlers/graphql_transport_ws_handler.py,sha256=5ivH7DJup0ZyGawAcj-n9VE_exBTje9Hou0_GIZCyD4,591
125
125
  strawberry/fastapi/handlers/graphql_ws_handler.py,sha256=OTloVUvEgXDpqjOlBAT1FnaNWRAglQgAt613YH06roc,537
126
- strawberry/fastapi/router.py,sha256=QJAhpTHU6vuYdDzIcTdjjTnzRVID5G_KXMxiX9DBxfQ,13341
126
+ strawberry/fastapi/router.py,sha256=BCPQxLJb6439-KqOD6wj5dDkcY2RaUo7u8pLI1EuSkU,12438
127
127
  strawberry/federation/__init__.py,sha256=FeUxLiBVuk9TKBmJJi51SeUaI8c80rS8hbl9No-hjII,535
128
128
  strawberry/federation/argument.py,sha256=2m_wgp7uFQDimTDDCBBqSoWeTop4MD1-KjjYrumEJIw,833
129
129
  strawberry/federation/enum.py,sha256=1rx50FiSMS-NjEFErhRSYB5no8TPsGMA_cH7hVbxAFI,3015
@@ -248,8 +248,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
248
248
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
249
249
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
250
250
  strawberry/utils/typing.py,sha256=tUHHX2YTGX417EEQHB6j0B8-p-fg31ZI8csc9SUoq2I,14260
251
- strawberry_graphql-0.237.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
252
- strawberry_graphql-0.237.1.dist-info/METADATA,sha256=_E8wmtdiW7S9ZTA40IsCxT-AweMtTFdvEDef4ODdQig,7821
253
- strawberry_graphql-0.237.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
254
- strawberry_graphql-0.237.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
255
- strawberry_graphql-0.237.1.dist-info/RECORD,,
251
+ strawberry_graphql-0.237.3.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
252
+ strawberry_graphql-0.237.3.dist-info/METADATA,sha256=sWyrEwqkg62uUtYwDNAq18skuwzvCaVZQnsLLCNeSKc,7821
253
+ strawberry_graphql-0.237.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
254
+ strawberry_graphql-0.237.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
255
+ strawberry_graphql-0.237.3.dist-info/RECORD,,