{"id":"5740f71830dd3cf6","repo":"aio-libs/aiohttp","slug":"method-not-allowed","errorCode":null,"errorMessage":"Method Not Allowed","messagePattern":"Method Not Allowed","errorType":"http","errorClass":"HTTPMethodNotAllowed","httpStatus":405,"severity":"error","filePath":"aiohttp/web_urldispatcher.py","lineNumber":933,"sourceCode":"\n\nclass View(AbstractView):\n    async def _iter(self) -> StreamResponse:\n        if self.request.method not in hdrs.METH_ALL:\n            self._raise_allowed_methods()\n        method: Callable[[], Awaitable[StreamResponse]] | None = getattr(\n            self, self.request.method.lower(), None\n        )\n        if method is None:\n            self._raise_allowed_methods()\n        return await method()\n\n    def __await__(self) -> Generator[None, None, StreamResponse]:\n        return self._iter().__await__()\n\n    def _raise_allowed_methods(self) -> NoReturn:\n        allowed_methods = {m for m in hdrs.METH_ALL if hasattr(self, m.lower())}\n        raise HTTPMethodNotAllowed(self.request.method, allowed_methods)\n\n\nclass ResourcesView(Sized, Iterable[AbstractResource], Container[AbstractResource]):\n    def __init__(self, resources: list[AbstractResource]) -> None:\n        self._resources = resources\n\n    def __len__(self) -> int:\n        return len(self._resources)\n\n    def __iter__(self) -> Iterator[AbstractResource]:\n        yield from self._resources\n\n    def __contains__(self, resource: object) -> bool:\n        return resource in self._resources\n\n\nclass RoutesView(Sized, Iterable[AbstractRoute], Container[AbstractRoute]):\n    def __init__(self, resources: list[AbstractResource]):","sourceCodeStart":915,"sourceCodeEnd":951,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/c0ef574e29109210e96e652771ae4e7b88615fa4/aiohttp/web_urldispatcher.py#L915-L951","documentation":"Error \"Method Not Allowed\" thrown in aio-libs/aiohttp.","triggerScenarios":"Thrown at aiohttp/web_urldispatcher.py:933 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"c0ef574e29109210e96e652771ae4e7b88615fa4","analyzedAt":"2026-08-04T19:51:05.467Z","schemaVersion":2}