如何处理缩放和api调用错误

2024-10-03 06:28:07 发布

您现在位置:Python中文网/ 问答频道 /正文

当我创建jwt并调用zoomapi时,我得到错误{'code':124,'message':'Invalid access token.'}。这是什么意思?

ApiKey = 'xxx'
ApiSercret = 'xxx'
mail = request.POST['mail']
print(mail)
today = datetime.today()
header = {
'alg':'HS256'
}

payload = { 
'iss': ApiKey,
'exp': today + timedelta(hours=1),
}

        #https://docs.authlib.org/en/latest/specs/rfc7519.html#authlib.jose.rfc7519.JWT.check_sensitive_data
token = jwt.encode(header,payload,ApiSercret,check='true')
print(token)
import http.client

        conn = http.client.HTTPSConnection("api.zoom.us")

        headers = {
            'authorization': "Bearer 39ug3j309t8unvmlmslmlkfw853u8",
            'content-type': "application/json"
        }   

        conn.request("GET", "/v2/users?status=active&page_size=30&page_number=1", headers=headers)

        res = conn.getresponse()
        data = res.read()

        print(data.decode("utf-8"))

params = {
mail:token
}

return render(request,'api/index.html',params)

错误内容

^{pr2}$

此错误是否是设置缩放api时出错? 我正在尝试在zoom api中获取会议列表。 我想打印get with print获取的内容。在


Tags: tokenapidatatodayrequest错误mailconn