飞书服务端接口-新建订阅接口用例执行报错

运行报400
<Response [400]>
FAILED
api_feishu/testcase/test_file/test_comments.py:37 (TestComments.test_create_subscription[创建订阅])
99991663 != 0

飞书接口地址:开发文档 - 飞书开放平台
具体代码:测试用例:

 @allure.story("创建订阅")
    @pytest.mark.parametrize("file_token", [("doccnMsg7Mhixgswirdqfj7kene")], ids=["创建订阅"])
    def test_create_subscription(self, file_token):
        r = self.sub.create_subscrip(file_token)
        assert r['code'] == 0

api

class Subscription(Feishu):
    # subs = Subscription()
    # file = File()
    def create_subscrip(self,file_token):
        # token = self.file.get_enter_token()
        data = {"url":f"https://open.feishu.cn/open-apis/drive/v1/files/{file_token}/subscriptions",
            "method":"post",
            "headers":{
                "Authorization": "Bearer " +  self.get_enter_token(),
                "Content-Type":"application/json; charset=utf-8"
            },
            "json":{
                "subscription_type": "comment_update",
                "file_type": "doc"
}}
        print(f"data:{json.dumps(data,ensure_ascii=False,indent=2)}")
        r = self.request(data)
        print(r)
        return r.json()

父类-Feishu

class Feishu(Base):
 def get_enter_token(self,token=None):
        if token !=None:
            return token
        data = {"method":"post",
                "url":"https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
                "params":{
                "app_id": "cli_a19ad1c1c338900e",
                "app_secret": "PR5TP8TEaYz3USPRKvnyEhai7hPoqBAL"
            }}
        r = self.request(data)
        token = r.json()['tenant_access_token']
        print(f"enter_token{token}")
        return token

基类

class Base:
    def request(self,request):
        if 'url' in request:
            self.log.info("http请求")
            return self.http_request(request)
        if 'rpc' in request:
            return self.rpc_request(request)

400是你的请求数据发的格式不对,我想你可能搞错数据格式 ,你把具体接口的请求和返回贴下吧

image
image

"url": "https://open.feishu.cn/open-apis/drive/v1/files/doccnMsg7Mhixgswirdqfj7kene/subscriptions",
  "method": "post",
  "headers": {
    "Authorization": "Bearer t-ed2e97a3a366a54756ff645db85c58be5727a4ae",
    "Content-Type": "application/json; charset=utf-8"
  },
  "json": {
    "subscription_type": "comment_update",
    "file_type": "doc"
  }

response:

{
	"code": 99991663,
	"msg": "tenant access token not support",
	"data": {}
}

token用错了吧,你看下文档里的描述,有好几个token,别搞混了

这个和获取评论接口一样,那个接口执行没有问题