We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
aiohttp-session
1 parent 747ec05 commit aef24faCopy full SHA for aef24fa
aiohttp_security/session_identity.py
@@ -6,7 +6,11 @@
6
7
import asyncio
8
9
-from aiohttp_session import get_session
+try:
10
+ from aiohttp_session import get_session
11
+ HAS_AIOHTTP_SESSION = True
12
+except ImportError: # pragma: no cover
13
+ HAS_AIOHTTP_SESSION = False
14
15
from .abc import AbstractIdentityPolicy
16
@@ -16,6 +20,10 @@ class SessionIdentityPolicy(AbstractIdentityPolicy):
20
def __init__(self, session_key='AIOHTTP_SECURITY'):
17
21
self._session_key = session_key
18
22
23
+ if not HAS_AIOHTTP_SESSION: # pragma: no cover
24
+ raise ImportError(
25
+ 'SessionIdentityPolicy requires `aiohttp_session`')
26
+
19
27
@asyncio.coroutine
28
def identify(self, request):
29
session = yield from get_session(request)
0 commit comments