Files
test/sg_wechat_enterprise/we_api/enterprise/client/api/service.py
2024-07-10 15:58:47 +08:00

46 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatService(BaseWeChatAPI):
def get_provider_token(self, provider_secret):
"""
获取应用提供商凭证
详情请参考
http://qydev.weixin.qq.com/wiki/index.php?title=获取应用提供商凭证
:param provider_secret: 提供商的secret在提供商管理页面可见
:return: 返回的 JSON 数据包
"""
return self._post(
'service/get_provider_token',
data={
'corpid': self._client.corp_id,
'provider_secret': provider_secret,
}
)
def get_login_info(self, provider_access_token, auth_code):
"""
获取企业号管理员登录信息
详情请参考
http://qydev.weixin.qq.com/wiki/index.php?title=获取企业号管理员登录信息
:param provider_access_token: 服务提供商的 accesstoken
:param auth_code: OAuth 2.0 授权企业号管理员登录产生的 code
:return: 返回的 JSON 数据包
"""
return self._post(
'service/get_login_info',
params={
'provider_access_token': provider_access_token,
},
data={
'auth_code': auth_code,
}
)