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 _update_headers(self, headers_dict):
|
24
|
|
|
return self._client.update_headers(headers_dict)
|
25
|
|
|
|
26
|
|
|
def _get_login_view_state(self, **kwargs):
|
27
|
|
|
return self._client.get_login_view_state(**kwargs)
|
28
|
|
|
|
29
|
|
|
def _set_proxy(self):
|
30
|
|
|
return self._client.set_proxy()
|
31
|
|
|
|
32
|
|
|
@property
|
33
|
|
|
def code(self):
|
|
|
|
|
34
|
|
|
return self._client.school.code
|
35
|
|
|
|
36
|
|
|
@property
|
37
|
|
|
def account(self):
|
|
|
|
|
38
|
|
|
return self._client.account
|
39
|
|
|
|
40
|
|
|
@property
|
41
|
|
|
def password(self):
|
|
|
|
|
42
|
|
|
return self._client.password
|
43
|
|
|
|
44
|
|
|
@property
|
45
|
|
|
def session(self):
|
|
|
|
|
46
|
|
|
return self._client.session
|
47
|
|
|
|
48
|
|
|
@property
|
49
|
|
|
def user_type(self):
|
|
|
|
|
50
|
|
|
return self._client.user_type
|
51
|
|
|
|
52
|
|
|
@property
|
53
|
|
|
def base_url(self):
|
|
|
|
|
54
|
|
|
return self._client.base_url
|
55
|
|
|
|
56
|
|
|
@property
|
57
|
|
|
def school_url(self):
|
|
|
|
|
58
|
|
|
return self._client.school.url_endpoint[self.user_type]
|
59
|
|
|
|
60
|
|
|
@property
|
61
|
|
|
def time_list(self):
|
|
|
|
|
62
|
|
|
return self._client.school.time_list
|
63
|
|
|
|
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.