Passed
Push — master ( b6dc32...e9e603 )
by dai
01:46
created

school_api.client.api.base   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 11
eloc 29
dl 0
loc 44
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A BaseSchoolApi._get() 0 2 1
A BaseSchoolApi._post() 0 2 1
A BaseSchoolApi.__init__() 0 2 1
A BaseSchoolApi._get_view_state() 0 2 1
A BaseSchoolApi._switch_proxy() 0 2 1
A BaseSchoolApi._update_url_token() 0 2 1
A BaseSchoolApi.user() 0 3 1
A BaseSchoolApi.school_url() 0 3 1
A BaseSchoolApi.school_code() 0 3 1
1
# -*- coding: utf-8 -*-
2
from __future__ import absolute_import, unicode_literals
3
4
5
class BaseSchoolApi(object):
6
    """ WeChat API base class """
7
8
    def __init__(self, client=None):
9
        self._client = client
10
11
    def _get(self, url, **kwargs):
12
        return self._client.get(url, **kwargs)
13
14
    def _post(self, url, **kwargs):
15
        return self._client.post(url, **kwargs)
16
17
    def _head(self, url, **kwargs):
18
        return self._client.head(url, **kwargs)
19
20
    def _get_view_state(self, url, **kwargs):
21
        return self._client.get_view_state(url, **kwargs)
22
23
    def _switch_proxy(self):
24
        return self._client.switch_proxy()
25
26
    def _update_url_token(self, url_token):
27
        return self._client.update_url_token(url_token)
28
29
    @property
30
    def school_code(self):
31
        return self._client.school.code
32
33
    @property
34
    def user(self):
35
        return self._client.user
36
37
    @property
38
    def school_url(self):
39
        return self._client.school.url_path_list[self.user.user_type]
40
41
    @property
42
    def time_list(self):
43
        return self._client.school.time_list
44