from morepath import App
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from onegov.core import cache
[docs]
class ApiApp(App):
if TYPE_CHECKING:
# forward declare Framework.get_cache
[docs]
def get_cache(
self,
name: str,
expiration_time: float
) -> cache.RedisCacheRegion: ...
@property
[docs]
def rate_limit_cache(self) -> 'cache.RedisCacheRegion':
""" A cache for rate limits. """
_limit, expiration = self.rate_limit
return self.get_cache('rate_limits', expiration)
@ApiApp.setting(section='api', name='endpoints')
[docs]
def get_api_endpoints() -> list[str]:
return []