Fix ImportError when redis optional dependency not installed

This commit is contained in:
François Voron
2021-12-30 15:47:31 +01:00
parent 925dad5207
commit dc15309b09
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,12 @@
from fastapi_users.authentication.authenticator import Authenticator
from fastapi_users.authentication.backend import AuthenticationBackend
from fastapi_users.authentication.strategy import JWTStrategy, RedisStrategy, Strategy
from fastapi_users.authentication.strategy import JWTStrategy, Strategy
try:
from fastapi_users.authentication.strategy import RedisStrategy
except ImportError: # pragma: no cover
pass
from fastapi_users.authentication.transport import (
BearerTransport,
CookieTransport,

View File

@ -3,7 +3,11 @@ from fastapi_users.authentication.strategy.base import (
StrategyDestroyNotSupportedError,
)
from fastapi_users.authentication.strategy.jwt import JWTStrategy
try:
from fastapi_users.authentication.strategy.redis import RedisStrategy
except ImportError: # pragma: no cover
pass
__all__ = [
"JWTStrategy",