Completed
Pull Request — master (#195)
by
unknown
10:55 queued 09:47
created

BaseWeChatAPI   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 26
ccs 17
cts 17
cp 1
rs 10
c 1
b 0
f 0
wmc 8

6 Methods

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