Blacked the code

This commit is contained in:
Eliot Berriot 2018-06-09 15:36:16 +02:00
parent b6fc0051fa
commit 62ca3bd736
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
279 changed files with 8861 additions and 9527 deletions

View file

@ -16,20 +16,19 @@ class TokenHeaderAuth(BaseJSONWebTokenAuthentication):
def get_jwt_value(self, request):
try:
qs = request.get('query_string', b'').decode('utf-8')
qs = request.get("query_string", b"").decode("utf-8")
parsed = parse_qs(qs)
token = parsed['token'][0]
token = parsed["token"][0]
except KeyError:
raise exceptions.AuthenticationFailed('No token')
raise exceptions.AuthenticationFailed("No token")
if not token:
raise exceptions.AuthenticationFailed('Empty token')
raise exceptions.AuthenticationFailed("Empty token")
return token
class TokenAuthMiddleware:
def __init__(self, inner):
# Store the ASGI application we were passed
self.inner = inner
@ -41,5 +40,5 @@ class TokenAuthMiddleware:
except (User.DoesNotExist, exceptions.AuthenticationFailed):
user = AnonymousUser()
scope['user'] = user
scope["user"] = user
return self.inner(scope)