X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/8495246162e34c6213633cfdc9a784c636bf75ca..a3f3fa4837a3364acc1d69f5f17b5153ca3af057:/src/api/views.py diff --git a/src/api/views.py b/src/api/views.py index 99c8df182..6762fb1da 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # @@ -11,13 +10,12 @@ from django.views.generic.base import View from oauthlib.common import urlencode from oauthlib.oauth1 import RequestTokenEndpoint, AccessTokenEndpoint from oauthlib.oauth1 import AuthorizationEndpoint, OAuth1Error -from api.models import KEY_SIZE, SECRET_SIZE from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView -from rest_framework.generics import ListAPIView, RetrieveAPIView, get_object_or_404 +from rest_framework.generics import RetrieveAPIView, get_object_or_404 from catalogue.models import Book -from .models import BookUserData +from .models import BookUserData, KEY_SIZE, SECRET_SIZE from . import serializers from .request_validator import PistonRequestValidator from .utils import oauthlib_request, oauthlib_response, vary_on_auth @@ -87,7 +85,7 @@ def oauth_user_auth(request): return render(request, 'oauth/authorize_token.html', {'form': form}) - elif request.method == "POST": + if request.method == "POST": try: response = oauthlib_response( endpoint.create_authorization_response(