先说结论:企微api暂不支持获取微盘文件列表功能,且未来也不大可能支持.
过程:
一,首先按惯例,获取token
import requests def get_access_token(corpid, corpsecret): url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={corpsecret}" response = requests.get(url) data = response.json() return data.get('access_token')
怎么从企微中找到corpid, corpsecret,自行搜索
这一步顺顺利利,可以连接成功
二,我尝试去拿文件列表,脚本如下
def get_file_message(access_token): url = f"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_list?access_token={access_token}" data = { "spaceid": "s.1970325736989685.663049851sLo", "fatherid": "s.1970325736989685.663049851sLo", "sort_type": 1, "start": 0, "limit": 100 } response = requests.post(url, json=data) return re