[scrobbles] Allow Bearer or Token
This commit is contained in:
@ -23,16 +23,12 @@ def build_scrobbles(client, request_json, num=7, spacing=2, auth_token=None):
|
||||
headers = {"Authorization": f"Token {auth_token}"}
|
||||
user = Token.objects.get(key=auth_token).user
|
||||
|
||||
client.post(
|
||||
url, request_json, content_type="application/json", headers=headers
|
||||
)
|
||||
client.post(url, request_json, content_type="application/json", headers=headers)
|
||||
track = Scrobble.objects.last().track
|
||||
|
||||
est = pytz.timezone("US/Eastern")
|
||||
for i in range(num):
|
||||
naive_time = timezone.now().replace(tzinfo=None) - timedelta(
|
||||
days=i * spacing
|
||||
)
|
||||
naive_time = timezone.now().replace(tzinfo=None) - timedelta(days=i * spacing)
|
||||
aware_time = est.localize(naive_time)
|
||||
Scrobble.objects.create(
|
||||
user=user,
|
||||
|
||||
@ -93,7 +93,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class WebhookView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
authentication_classes = [BearerTokenAuthentication]
|
||||
authentication_classes = [TokenAuthentication, BearerTokenAuthentication]
|
||||
|
||||
@property
|
||||
def logger(self):
|
||||
|
||||
Reference in New Issue
Block a user