[scrobbles] Add tokenauth to webhookview
This commit is contained in:
@ -13,6 +13,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||||||
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
|
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
|
||||||
from django.db.models import Count, Max, Q
|
from django.db.models import Count, Max, Q
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
from rest_framework.authentication import TokenAuthentication
|
||||||
from django.http import (
|
from django.http import (
|
||||||
FileResponse,
|
FileResponse,
|
||||||
Http404,
|
Http404,
|
||||||
@ -83,6 +84,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class WebhookView(APIView):
|
class WebhookView(APIView):
|
||||||
permission_classes = [IsAuthenticated]
|
permission_classes = [IsAuthenticated]
|
||||||
|
authentication_classes = [TokenAuthentication]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def logger(self):
|
def logger(self):
|
||||||
|
|||||||
@ -3,9 +3,8 @@ import logging
|
|||||||
|
|
||||||
from profiles.models import UserProfile
|
from profiles.models import UserProfile
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.permissions import IsAuthenticated
|
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from scrobbles.views import WebhookView
|
||||||
from scrobbles.scrobblers import (
|
from scrobbles.scrobblers import (
|
||||||
emacs_scrobble_task,
|
emacs_scrobble_task,
|
||||||
emacs_scrobble_update_task,
|
emacs_scrobble_update_task,
|
||||||
@ -16,14 +15,6 @@ from scrobbles.scrobblers import (
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class WebhookView(APIView):
|
|
||||||
permission_classes = [IsAuthenticated]
|
|
||||||
|
|
||||||
@property
|
|
||||||
def logger(self):
|
|
||||||
return logger
|
|
||||||
|
|
||||||
|
|
||||||
class TodoistWebhookView(WebhookView):
|
class TodoistWebhookView(WebhookView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
post_data = request.data
|
post_data = request.data
|
||||||
|
|||||||
Reference in New Issue
Block a user