@@ 5-30 (lines=26) @@ | ||
2 | from __future__ import absolute_import, unicode_literals |
|
3 | ||
4 | ||
5 | class BaseWeChatPayAPI(object): |
|
6 | """ WeChat Pay API base class """ |
|
7 | def __init__(self, client=None): |
|
8 | self._client = client |
|
9 | ||
10 | def _get(self, url, **kwargs): |
|
11 | if getattr(self, 'API_BASE_URL', None): |
|
12 | kwargs['api_base_url'] = self.API_BASE_URL |
|
13 | return self._client.get(url, **kwargs) |
|
14 | ||
15 | def _post(self, url, **kwargs): |
|
16 | if getattr(self, 'API_BASE_URL', None): |
|
17 | kwargs['api_base_url'] = self.API_BASE_URL |
|
18 | return self._client.post(url, **kwargs) |
|
19 | ||
20 | @property |
|
21 | def appid(self): |
|
22 | return self._client.appid |
|
23 | ||
24 | @property |
|
25 | def mch_id(self): |
|
26 | return self._client.mch_id |
|
27 | ||
28 | @property |
|
29 | def sub_mch_id(self): |
|
30 | return self._client.sub_mch_id |
|
31 |
@@ 5-30 (lines=26) @@ | ||
2 | from __future__ import absolute_import, unicode_literals |
|
3 | ||
4 | ||
5 | class BaseWeChatAPI(object): |
|
6 | """ WeChat API base class """ |
|
7 | def __init__(self, client=None): |
|
8 | self._client = client |
|
9 | ||
10 | def _get(self, url, **kwargs): |
|
11 | if getattr(self, 'API_BASE_URL', None): |
|
12 | kwargs['api_base_url'] = self.API_BASE_URL |
|
13 | return self._client.get(url, **kwargs) |
|
14 | ||
15 | def _post(self, url, **kwargs): |
|
16 | if getattr(self, 'API_BASE_URL', None): |
|
17 | kwargs['api_base_url'] = self.API_BASE_URL |
|
18 | return self._client.post(url, **kwargs) |
|
19 | ||
20 | @property |
|
21 | def access_token(self): |
|
22 | return self._client.access_token |
|
23 | ||
24 | @property |
|
25 | def session(self): |
|
26 | return self._client.session |
|
27 | ||
28 | @property |
|
29 | def appid(self): |
|
30 | return self._client.appid |
|
31 |