1. 扫码登陆
用于Python Web应用扫码登陆的一个功能函数。
dingtalk_auth(request)
| 参数 | 说明 |
|---|---|
| request | 一个标准的WSGI HTTP Request,详见PEP333/PEP3333 |
| --- | --- |
| DINGTALK_APPID | 钉钉E应用的APPID,请自行存储于os.environ |
| DINGTALK_APPSECRET | 钉钉E应用的APPSECRET,请自行存储于os.environ |
| DINGTALK_APPKEY | 钉钉扫码登陆(网页认证)的APPKEY,请自行存储于os.environ |
| DINGTALK_SECRET | 钉钉扫码登陆(网页认证)的SECRET,请自行存储于os.environ |
| --- | --- |
2. 部门成员获取
get_department_users(access_token=None, department_name=None, root=1)
| 参数 | 说明 |
|---|---|
| access_token | 全局的access_token |
| department_name | 部门名称,不论几级部门均可 |
| root | 请求的初始部门ID,默认为根部门 |
3. Django集成
DingtalkNotificationMixin
| 方法(属性) | 说明 |
|---|---|
| appkey | 注册E应用获取到的appkey |
| appsecret | 注册E应用获取到的appsecret |
| send_dingtalk_result | Bool型变量,用于判断发送工作通知的结果 |
| send_work_notice(content, sender, recipients) | 发送钉钉工作通知 |
| send_group_message(self, content, chat_id) | 发送钉钉群消息 |