From 322ac98c5083abeb9d166faca1bbc2c0590fd8bb Mon Sep 17 00:00:00 2001 From: StarHeartHunt Date: Tue, 6 Jul 2021 10:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20validate=20`schema`=20field=20&?= =?UTF-8?q?=20fix=20request=20construct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py b/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py index 88932aae..a4582477 100644 --- a/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py +++ b/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py @@ -131,6 +131,10 @@ class Bot(BaseBot): "challenge": challenge }).encode()) + schema = data.get("schema") + if not schema: + return None, HTTPResponse(400, b"Missing `schema` in POST body, only accept event of version 2.0") + headers = data.get("header") if headers: token = headers.get("token") @@ -230,7 +234,8 @@ class Bot(BaseBot): async with httpx.AsyncClient(headers=headers) as client: response = await client.post( self.api_root + api, - json=data, + json=data["body"], + params=data["query"], timeout=self.config.api_timeout) print(response.json())