Skip to content

Commit

Permalink
Update enterprise client
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed May 13, 2015
1 parent 8c5172b commit beb84f5
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions wechatpy/enterprise/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import weakref

from wechatpy.client.base import BaseWeChatClient
from wechatpy.enterprise.client import api
Expand All @@ -10,24 +9,22 @@ class WeChatClient(BaseWeChatClient):

API_BASE_URL = 'https://qyapi.weixin.qq.com/cgi-bin/'

user = api.WeChatUser()
department = api.WeChatDepartment()
menu = api.WeChatMenu()
message = api.WeChatMessage()
tag = api.WeChatTag()
media = api.WeChatMedia()
misc = api.WeChatMisc()
agent = api.WeChatAgent()
batch = api.WeChatBatch()

def __init__(self, corp_id, secret, access_token=None):
self.corp_id = corp_id
self.secret = secret
self._access_token = access_token
self.expires_at = None

weak_self = weakref.proxy(self)
# APIs
self.user = api.WeChatUser(weak_self)
self.department = api.WeChatDepartment(weak_self)
self.menu = api.WeChatMenu(weak_self)
self.message = api.WeChatMessage(weak_self)
self.tag = api.WeChatTag(weak_self)
self.media = api.WeChatMedia(weak_self)
self.misc = api.WeChatMisc(weak_self)
self.agent = api.WeChatAgent(weak_self)
self.batch = api.WeChatBatch(weak_self)

def fetch_access_token(self):
""" Fetch access token"""
return self._fetch_access_token(
Expand Down

0 comments on commit beb84f5

Please sign in to comment.