Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call in APIRouter'? #117

Open
china-zhoujie opened this issue Nov 3, 2022 · 2 comments
Open

How to call in APIRouter'? #117

china-zhoujie opened this issue Nov 3, 2022 · 2 comments

Comments

@china-zhoujie
Copy link

How to call in APIRouter'?
Error:AttributeError: 'APIRouter' object has no attribute 'state'

@laurentS
Copy link
Owner

laurentS commented Nov 8, 2022

Hi @china-zhoujie can you share your code and the full error message you are seeing?
Also please include the versions of Fastapi/starlette that you're using.

It is impossible to help you with what you shared.

@marrocksd
Copy link

Init in the main module,
then just reuse in the Router, don't init again

from slowapi import Limiter
from slowapi.util import get_remote_address

limiter = Limiter(key_func=get_remote_address)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants