librarian-bot commited on
Commit
0b71383
1 Parent(s): c5e6c69

directly await JSON response from request

Browse files
Files changed (1) hide show
  1. main.py +1 -2
main.py CHANGED
@@ -163,7 +163,6 @@ async def webhook(request: Request):
163
  if request.method == "POST":
164
  if request.headers.get("X-Webhook-Secret") != KEY:
165
  return Response("Invalid secret", status_code=401)
166
- payload = await request.body()
167
- data = json.loads(payload)
168
  result = create_or_update_report(data)
169
  return "Webhook received!" if result else result
 
163
  if request.method == "POST":
164
  if request.headers.get("X-Webhook-Secret") != KEY:
165
  return Response("Invalid secret", status_code=401)
166
+ data = await request.json()
 
167
  result = create_or_update_report(data)
168
  return "Webhook received!" if result else result