Routes
- class q2_sdk.core.routes.Router[source]
Bases:
object
This class is a singleton that provides a decorator that can be used to add methods to a handlers router dictionary.
from q2_sdk.core import routes ... @property def router(self): router = super().router router.update({ # if you use the ``routes`` decorator then you do not need to add route # keys here "default": self.default, # "example_route": self.example_route, is added automatically # "another_route": self.some_route, is added automatically }) @routes.add async def example_route(self): # this method will be added to the routes dictionary with the key being the # name of the method @routes.add(name="another_route") async def some_route(self): # this method will be added to the routes dictionary with the key provided # by the ``name`` parameter to ``add``