久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

如何基于python對(duì)接釘釘并獲取access_token

瀏覽:145日期:2022-07-29 13:34:37

1.首先注冊(cè)應(yīng)用,獲取 appkey、appsecret

api_url = 'https://oapi.dingtalk.com/gettoken?appkey=%s&appsecret=%s'%(appkey,appsecret)def get_token(): # try: res = requests.get(api_url) if res.status_code == 200: str_res = res.text token = (json.loads(str_res)).get(’access_token’) return token

2.此時(shí)拿到的token就是access_token,可以用它來發(fā)送請(qǐng)求了

def departList(): # 所有部門信息 url = ’https://oapi.dingtalk.com/department/list?access_token={}’.format(get_token()) ret = json.loads(requests.get(url).text) department = ret.get(’department’) departList = [] for department_info in department: departdict = {} departdict[’name’] = department_info.get(’name’) departdict[’id’] = department_info.get(’id’) departdict[’parentid’] = department_info.get(’parentid’) departList.append(departdict) return departList

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: 釘釘 Python
相關(guān)文章:
主站蜘蛛池模板: 商洛市| 浪卡子县| 波密县| 叶城县| 南木林县| 河北省| 获嘉县| 仁怀市| 永靖县| 泰来县| 涟水县| 称多县| 开远市| 甘孜县| 九龙城区| 始兴县| 凤阳县| 军事| 乌苏市| 万载县| 山阳县| 五寨县| 松原市| 汉川市| 开平市| 通州区| 广昌县| 伊川县| 松潘县| 舞阳县| 枞阳县| 木兰县| 常州市| 方正县| 昂仁县| 娄底市| 双辽市| 东乡族自治县| 东山县| 青铜峡市| 开阳县|