|
39 | 39 | GetExtendedAgentCardRequest, |
40 | 40 | GetTaskPushNotificationConfigRequest, |
41 | 41 | GetTaskRequest, |
42 | | - ListTaskPushNotificationConfigRequest, |
| 42 | + ListTaskPushNotificationConfigsRequest, |
43 | 43 | ListTasksRequest, |
44 | 44 | SendMessageRequest, |
45 | 45 | SubscribeToTaskRequest, |
|
70 | 70 | from starlette.exceptions import HTTPException |
71 | 71 | from starlette.requests import Request |
72 | 72 | from starlette.responses import JSONResponse, Response |
73 | | - from starlette.status import HTTP_413_REQUEST_ENTITY_TOO_LARGE |
| 73 | + |
| 74 | + try: |
| 75 | + # Starlette v0.48.0 |
| 76 | + from starlette.status import HTTP_413_CONTENT_TOO_LARGE |
| 77 | + except ImportError: |
| 78 | + from starlette.status import ( # type: ignore[no-redef] |
| 79 | + HTTP_413_REQUEST_ENTITY_TOO_LARGE as HTTP_413_CONTENT_TOO_LARGE, |
| 80 | + ) |
74 | 81 |
|
75 | 82 | _package_starlette_installed = True |
76 | 83 | else: |
|
82 | 89 | from starlette.exceptions import HTTPException |
83 | 90 | from starlette.requests import Request |
84 | 91 | from starlette.responses import JSONResponse, Response |
85 | | - from starlette.status import HTTP_413_REQUEST_ENTITY_TOO_LARGE |
| 92 | + |
| 93 | + try: |
| 94 | + # Starlette v0.48.0 |
| 95 | + from starlette.status import HTTP_413_CONTENT_TOO_LARGE |
| 96 | + except ImportError: |
| 97 | + from starlette.status import ( |
| 98 | + HTTP_413_REQUEST_ENTITY_TOO_LARGE as HTTP_413_CONTENT_TOO_LARGE, |
| 99 | + ) |
86 | 100 |
|
87 | 101 | _package_starlette_installed = True |
88 | 102 | except ImportError: |
|
96 | 110 | Request = Any |
97 | 111 | JSONResponse = Any |
98 | 112 | Response = Any |
99 | | - HTTP_413_REQUEST_ENTITY_TOO_LARGE = Any |
| 113 | + HTTP_413_CONTENT_TOO_LARGE = Any |
100 | 114 |
|
101 | 115 |
|
102 | 116 | class StarletteUserProxy(A2AUser): |
@@ -171,7 +185,7 @@ class JSONRPCApplication(ABC): |
171 | 185 | 'CancelTask': CancelTaskRequest, |
172 | 186 | 'CreateTaskPushNotificationConfig': CreateTaskPushNotificationConfigRequest, |
173 | 187 | 'GetTaskPushNotificationConfig': GetTaskPushNotificationConfigRequest, |
174 | | - 'ListTaskPushNotificationConfig': ListTaskPushNotificationConfigRequest, |
| 188 | + 'ListTaskPushNotificationConfigs': ListTaskPushNotificationConfigsRequest, |
175 | 189 | 'DeleteTaskPushNotificationConfig': DeleteTaskPushNotificationConfigRequest, |
176 | 190 | 'SubscribeToTask': SubscribeToTaskRequest, |
177 | 191 | 'GetExtendedAgentCard': GetExtendedAgentCardRequest, |
@@ -394,7 +408,7 @@ async def _handle_requests(self, request: Request) -> Response: # noqa: PLR0911 |
394 | 408 | None, JSONParseError(message=str(e)) |
395 | 409 | ) |
396 | 410 | except HTTPException as e: |
397 | | - if e.status_code == HTTP_413_REQUEST_ENTITY_TOO_LARGE: |
| 411 | + if e.status_code == HTTP_413_CONTENT_TOO_LARGE: |
398 | 412 | return self._generate_error_response( |
399 | 413 | request_id, |
400 | 414 | InvalidRequestError(message='Payload too large'), |
@@ -486,9 +500,9 @@ async def _process_non_streaming_request( |
486 | 500 | context, |
487 | 501 | ) |
488 | 502 | ) |
489 | | - case ListTaskPushNotificationConfigRequest(): |
| 503 | + case ListTaskPushNotificationConfigsRequest(): |
490 | 504 | handler_result = ( |
491 | | - await self.handler.list_push_notification_config( |
| 505 | + await self.handler.list_push_notification_configs( |
492 | 506 | request_obj, |
493 | 507 | context, |
494 | 508 | ) |
|
0 commit comments