mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 14:57:42 +00:00
Autogenerated type safety parameterisation of all methods
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
import tornado
|
||||
@@ -20,7 +22,7 @@ class V1RedirectHandler(tornado.web.RequestHandler):
|
||||
"""Transparently proxies requests from the old API to the new one,
|
||||
returning whatever the v2 endpoint returns, for endpoints with no breaking changes."""
|
||||
|
||||
async def _proxy(self, path):
|
||||
async def _proxy(self, path: str) -> None:
|
||||
new_url = f"{self.request.protocol}://{self.request.host}/api/v2/{path}"
|
||||
if self.request.query:
|
||||
new_url += f"?{self.request.query}"
|
||||
@@ -61,8 +63,8 @@ class V1RedirectHandler(tornado.web.RequestHandler):
|
||||
if response.body:
|
||||
self.write(response.body)
|
||||
|
||||
async def get(self, path):
|
||||
async def get(self, path: str) -> None:
|
||||
await self._proxy(path)
|
||||
|
||||
async def post(self, path):
|
||||
async def post(self, path: str) -> None:
|
||||
await self._proxy(path)
|
||||
|
||||
Reference in New Issue
Block a user