diff --git a/src/snek/view/push.py b/src/snek/view/push.py index 036cf85..15b082d 100644 --- a/src/snek/view/push.py +++ b/src/snek/view/push.py @@ -63,12 +63,14 @@ class PushView(BaseFormView): body = await self.request.json() - if not ( - "encoding" in body - and "endpoint" in body - and "keys" in body - and "p256dh" in body["keys"] - and "auth" in body["keys"] + if not all( + [ + "encoding" in body, + "endpoint" in body, + "keys" in body, + "p256dh" in body["keys"], + "auth" in body["keys"], + ] ): return await self.json_response( {"error": "Invalid request"}, status=400 @@ -85,7 +87,7 @@ class PushView(BaseFormView): } notification_info = notifications.create_notification_info_with_payload( - body['endpoint'], + body["endpoint"], body["keys"]["auth"], body["keys"]["p256dh"], json.dumps(test_payload), @@ -98,7 +100,9 @@ class PushView(BaseFormView): print(headers) - post_notification = requests.post(body["endpoint"], headers=headers, data=notification_info["data"]) + post_notification = requests.post( + body["endpoint"], headers=headers, data=notification_info["data"] + ) print(post_notification.status_code) print(post_notification.text)