educabiz 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- educabiz-0.0.1/LICENSE +21 -0
- educabiz-0.0.1/PKG-INFO +25 -0
- educabiz-0.0.1/README.md +15 -0
- educabiz-0.0.1/educabiz/__init__.py +16 -0
- educabiz-0.0.1/educabiz/__main__.py +131 -0
- educabiz-0.0.1/educabiz/client.py +112 -0
- educabiz-0.0.1/educabiz.egg-info/PKG-INFO +25 -0
- educabiz-0.0.1/educabiz.egg-info/SOURCES.txt +12 -0
- educabiz-0.0.1/educabiz.egg-info/dependency_links.txt +1 -0
- educabiz-0.0.1/educabiz.egg-info/entry_points.txt +2 -0
- educabiz-0.0.1/educabiz.egg-info/top_level.txt +1 -0
- educabiz-0.0.1/pyproject.toml +63 -0
- educabiz-0.0.1/setup.cfg +4 -0
- educabiz-0.0.1/tests/test_client.py +8 -0
educabiz-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Filipe Pina
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
educabiz-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: educabiz
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: API client for *.educabiz.com
|
|
5
|
+
Author-email: Filipe Pina <shelf-corncob-said@duck.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/fopina/python-educabiz
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
|
|
11
|
+
# python package template
|
|
12
|
+
|
|
13
|
+
## Content
|
|
14
|
+
|
|
15
|
+
* `pytest` for tests: `make test`
|
|
16
|
+
* `ruff` for linting/formatting: `make lint` (replaces both `black` and `isort`)
|
|
17
|
+
* `.github` with actions ready to test PRs and publish releases
|
|
18
|
+
|
|
19
|
+
## New project checklist
|
|
20
|
+
|
|
21
|
+
* [ ] Replace `example` with *the* package
|
|
22
|
+
* [ ] Replace `LICENSE` if MIT does not apply
|
|
23
|
+
* [ ] Search the project for `# TODO` to find the (minimum list of) places that need to be changed.
|
|
24
|
+
* [ ] Add PYPI credentials to secrets
|
|
25
|
+
|
educabiz-0.0.1/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# python package template
|
|
2
|
+
|
|
3
|
+
## Content
|
|
4
|
+
|
|
5
|
+
* `pytest` for tests: `make test`
|
|
6
|
+
* `ruff` for linting/formatting: `make lint` (replaces both `black` and `isort`)
|
|
7
|
+
* `.github` with actions ready to test PRs and publish releases
|
|
8
|
+
|
|
9
|
+
## New project checklist
|
|
10
|
+
|
|
11
|
+
* [ ] Replace `example` with *the* package
|
|
12
|
+
* [ ] Replace `LICENSE` if MIT does not apply
|
|
13
|
+
* [ ] Search the project for `# TODO` to find the (minimum list of) places that need to be changed.
|
|
14
|
+
* [ ] Add PYPI credentials to secrets
|
|
15
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
from typing import Tuple, Union
|
|
5
|
+
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '0.0.1'
|
|
16
|
+
__version_tuple__ = version_tuple = tuple(map(int, version.split('.')))
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env -S python3 -u
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
import dotenv
|
|
5
|
+
import os
|
|
6
|
+
from datetime import datetime, date
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Client(requests.Session):
|
|
10
|
+
URL = 'https://mobile.educabiz.com'
|
|
11
|
+
|
|
12
|
+
def request(self, method, url, *a, **b):
|
|
13
|
+
if url[0] == '/':
|
|
14
|
+
url = f'{self.URL}{url}'
|
|
15
|
+
return super().request(method, url, *a, **b)
|
|
16
|
+
|
|
17
|
+
def login(self, username, password):
|
|
18
|
+
r = self.post('/mobile/login', data={'username': username, 'password': password})
|
|
19
|
+
r.raise_for_status()
|
|
20
|
+
r = r.json()
|
|
21
|
+
assert r['status'] == 'ok'
|
|
22
|
+
return r
|
|
23
|
+
|
|
24
|
+
def home(self):
|
|
25
|
+
r = self.get('/educators/home')
|
|
26
|
+
r.raise_for_status()
|
|
27
|
+
return r.json()
|
|
28
|
+
|
|
29
|
+
def notifications(self):
|
|
30
|
+
r = self.get('/educators/notifications')
|
|
31
|
+
r.raise_for_status()
|
|
32
|
+
return r.json()
|
|
33
|
+
|
|
34
|
+
def child_payments(self, child):
|
|
35
|
+
r = self.get(f'/child/{child}/payments')
|
|
36
|
+
r.raise_for_status()
|
|
37
|
+
return r.json()
|
|
38
|
+
|
|
39
|
+
def child_report(self, child, page=0, build_page=False):
|
|
40
|
+
r = self.post(f'/child/{child}/report', data={'page': page, 'buildPage': build_page})
|
|
41
|
+
r.raise_for_status()
|
|
42
|
+
return r.json()
|
|
43
|
+
|
|
44
|
+
def child_messages(self, child, page=1):
|
|
45
|
+
r = self.get(f'/child/{child}/messages/income', params={'page': page})
|
|
46
|
+
r.raise_for_status()
|
|
47
|
+
return r.json()
|
|
48
|
+
|
|
49
|
+
def child_services(self, child):
|
|
50
|
+
r = self.get(f'/child/{child}/services')
|
|
51
|
+
r.raise_for_status()
|
|
52
|
+
return r.json()
|
|
53
|
+
|
|
54
|
+
def child_timetable(self, child):
|
|
55
|
+
r = self.get(f'/child/{child}/timetable')
|
|
56
|
+
r.raise_for_status()
|
|
57
|
+
return r.json()
|
|
58
|
+
|
|
59
|
+
def child_gallery(self, child, page=1, build_page=False):
|
|
60
|
+
r = self.get(
|
|
61
|
+
f'/child/{child}/gallery',
|
|
62
|
+
params={
|
|
63
|
+
'page': page,
|
|
64
|
+
'buildPage': build_page,
|
|
65
|
+
'childId': child,
|
|
66
|
+
'serviceId': '',
|
|
67
|
+
},
|
|
68
|
+
)
|
|
69
|
+
r.raise_for_status()
|
|
70
|
+
return r.json()
|
|
71
|
+
|
|
72
|
+
def school_qrcodeinfo(self):
|
|
73
|
+
r = self.get(
|
|
74
|
+
'/school/qrcodeinfo',
|
|
75
|
+
)
|
|
76
|
+
r.raise_for_status()
|
|
77
|
+
return r.json()
|
|
78
|
+
|
|
79
|
+
def _bool(self, b):
|
|
80
|
+
return 'true' if b else 'false'
|
|
81
|
+
|
|
82
|
+
def _schoolctrl_save_presence(
|
|
83
|
+
self,
|
|
84
|
+
path: str,
|
|
85
|
+
child_id: str,
|
|
86
|
+
date: date,
|
|
87
|
+
notes='',
|
|
88
|
+
absent=False,
|
|
89
|
+
is_checked=True,
|
|
90
|
+
is_enter=False,
|
|
91
|
+
number_day=1,
|
|
92
|
+
):
|
|
93
|
+
r = self.post(
|
|
94
|
+
f'/schoolctrl/{path}',
|
|
95
|
+
data={
|
|
96
|
+
'colabId': '',
|
|
97
|
+
'date': date.strftime('%d-%m-%Y'),
|
|
98
|
+
'notes': notes,
|
|
99
|
+
'absent': self._bool(absent),
|
|
100
|
+
'isChecked': self._bool(is_checked),
|
|
101
|
+
'isEnter': self._bool(is_enter),
|
|
102
|
+
'numberDay': number_day,
|
|
103
|
+
'childId': child_id,
|
|
104
|
+
},
|
|
105
|
+
)
|
|
106
|
+
r.raise_for_status()
|
|
107
|
+
return r.json()
|
|
108
|
+
|
|
109
|
+
def schoolctrl_save_presence_note(self, child_id: str, date: datetime.date, notes=''):
|
|
110
|
+
return self._schoolctrl_save_presence('savepresencesinglenote', child_id, date, notes=notes, absent=True)
|
|
111
|
+
|
|
112
|
+
def schoolctrl_save_presence_out(self, child_id: str, date: datetime.date):
|
|
113
|
+
return self._schoolctrl_save_presence('savepresenceout', child_id, date)
|
|
114
|
+
|
|
115
|
+
def schoolctrl_save_presence_in(self, child_id: str, date: datetime.date):
|
|
116
|
+
return self._schoolctrl_save_presence('savepresencein', child_id, date, is_enter=True)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def cli():
|
|
120
|
+
dotenv.load_dotenv()
|
|
121
|
+
c = Client()
|
|
122
|
+
c.login(os.getenv('EDUCA_USERNAME'), os.getenv('EDUCA_PASSWORD'))
|
|
123
|
+
data = c.home()
|
|
124
|
+
print(f'School: {data["schoolname"]}')
|
|
125
|
+
for child_id, child in data['children'].items():
|
|
126
|
+
print(f'{child_id}:')
|
|
127
|
+
print(f'* Name: {child["name"]}')
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == '__main__':
|
|
131
|
+
cli()
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
from datetime import date
|
|
2
|
+
import requests
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Client(requests.Session):
|
|
6
|
+
URL = 'https://mobile.educabiz.com'
|
|
7
|
+
|
|
8
|
+
def request(self, method, url, *a, **b):
|
|
9
|
+
if url[0] == '/':
|
|
10
|
+
url = f'{self.URL}{url}'
|
|
11
|
+
return super().request(method, url, *a, **b)
|
|
12
|
+
|
|
13
|
+
def login(self, username, password):
|
|
14
|
+
r = self.post('/mobile/login', data={'username': username, 'password': password})
|
|
15
|
+
r.raise_for_status()
|
|
16
|
+
r = r.json()
|
|
17
|
+
assert r['status'] == 'ok'
|
|
18
|
+
return r
|
|
19
|
+
|
|
20
|
+
def home(self):
|
|
21
|
+
r = self.get('/educators/home')
|
|
22
|
+
r.raise_for_status()
|
|
23
|
+
return r.json()
|
|
24
|
+
|
|
25
|
+
def notifications(self):
|
|
26
|
+
r = self.get('/educators/notifications')
|
|
27
|
+
r.raise_for_status()
|
|
28
|
+
return r.json()
|
|
29
|
+
|
|
30
|
+
def child_payments(self, child):
|
|
31
|
+
r = self.get(f'/child/{child}/payments')
|
|
32
|
+
r.raise_for_status()
|
|
33
|
+
return r.json()
|
|
34
|
+
|
|
35
|
+
def child_report(self, child, page=0, build_page=False):
|
|
36
|
+
r = self.post(f'/child/{child}/report', data={'page': page, 'buildPage': build_page})
|
|
37
|
+
r.raise_for_status()
|
|
38
|
+
return r.json()
|
|
39
|
+
|
|
40
|
+
def child_messages(self, child, page=1):
|
|
41
|
+
r = self.get(f'/child/{child}/messages/income', params={'page': page})
|
|
42
|
+
r.raise_for_status()
|
|
43
|
+
return r.json()
|
|
44
|
+
|
|
45
|
+
def child_services(self, child):
|
|
46
|
+
r = self.get(f'/child/{child}/services')
|
|
47
|
+
r.raise_for_status()
|
|
48
|
+
return r.json()
|
|
49
|
+
|
|
50
|
+
def child_timetable(self, child):
|
|
51
|
+
r = self.get(f'/child/{child}/timetable')
|
|
52
|
+
r.raise_for_status()
|
|
53
|
+
return r.json()
|
|
54
|
+
|
|
55
|
+
def child_gallery(self, child, page=1, build_page=False):
|
|
56
|
+
r = self.get(
|
|
57
|
+
f'/child/{child}/gallery',
|
|
58
|
+
params={
|
|
59
|
+
'page': page,
|
|
60
|
+
'buildPage': build_page,
|
|
61
|
+
'childId': child,
|
|
62
|
+
'serviceId': '',
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
r.raise_for_status()
|
|
66
|
+
return r.json()
|
|
67
|
+
|
|
68
|
+
def school_qrcodeinfo(self):
|
|
69
|
+
r = self.get(
|
|
70
|
+
'/school/qrcodeinfo',
|
|
71
|
+
)
|
|
72
|
+
r.raise_for_status()
|
|
73
|
+
return r.json()
|
|
74
|
+
|
|
75
|
+
def _bool(self, b):
|
|
76
|
+
return 'true' if b else 'false'
|
|
77
|
+
|
|
78
|
+
def _schoolctrl_save_presence(
|
|
79
|
+
self,
|
|
80
|
+
path: str,
|
|
81
|
+
child_id: str,
|
|
82
|
+
date: date,
|
|
83
|
+
notes='',
|
|
84
|
+
absent=False,
|
|
85
|
+
is_checked=True,
|
|
86
|
+
is_enter=False,
|
|
87
|
+
number_day=1,
|
|
88
|
+
):
|
|
89
|
+
r = self.post(
|
|
90
|
+
f'/schoolctrl/{path}',
|
|
91
|
+
data={
|
|
92
|
+
'colabId': '',
|
|
93
|
+
'date': date.strftime('%d-%m-%Y'),
|
|
94
|
+
'notes': notes,
|
|
95
|
+
'absent': self._bool(absent),
|
|
96
|
+
'isChecked': self._bool(is_checked),
|
|
97
|
+
'isEnter': self._bool(is_enter),
|
|
98
|
+
'numberDay': number_day,
|
|
99
|
+
'childId': child_id,
|
|
100
|
+
},
|
|
101
|
+
)
|
|
102
|
+
r.raise_for_status()
|
|
103
|
+
return r.json()
|
|
104
|
+
|
|
105
|
+
def schoolctrl_save_presence_note(self, child_id: str, date: date, notes=''):
|
|
106
|
+
return self._schoolctrl_save_presence('savepresencesinglenote', child_id, date, notes=notes, absent=True)
|
|
107
|
+
|
|
108
|
+
def schoolctrl_save_presence_out(self, child_id: str, date: date):
|
|
109
|
+
return self._schoolctrl_save_presence('savepresenceout', child_id, date)
|
|
110
|
+
|
|
111
|
+
def schoolctrl_save_presence_in(self, child_id: str, date: date):
|
|
112
|
+
return self._schoolctrl_save_presence('savepresencein', child_id, date, is_enter=True)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: educabiz
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: API client for *.educabiz.com
|
|
5
|
+
Author-email: Filipe Pina <shelf-corncob-said@duck.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/fopina/python-educabiz
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
|
|
11
|
+
# python package template
|
|
12
|
+
|
|
13
|
+
## Content
|
|
14
|
+
|
|
15
|
+
* `pytest` for tests: `make test`
|
|
16
|
+
* `ruff` for linting/formatting: `make lint` (replaces both `black` and `isort`)
|
|
17
|
+
* `.github` with actions ready to test PRs and publish releases
|
|
18
|
+
|
|
19
|
+
## New project checklist
|
|
20
|
+
|
|
21
|
+
* [ ] Replace `example` with *the* package
|
|
22
|
+
* [ ] Replace `LICENSE` if MIT does not apply
|
|
23
|
+
* [ ] Search the project for `# TODO` to find the (minimum list of) places that need to be changed.
|
|
24
|
+
* [ ] Add PYPI credentials to secrets
|
|
25
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
educabiz/__init__.py
|
|
5
|
+
educabiz/__main__.py
|
|
6
|
+
educabiz/client.py
|
|
7
|
+
educabiz.egg-info/PKG-INFO
|
|
8
|
+
educabiz.egg-info/SOURCES.txt
|
|
9
|
+
educabiz.egg-info/dependency_links.txt
|
|
10
|
+
educabiz.egg-info/entry_points.txt
|
|
11
|
+
educabiz.egg-info/top_level.txt
|
|
12
|
+
tests/test_client.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
educabiz
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0,<69.3.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "educabiz"
|
|
7
|
+
authors = [{name="Filipe Pina", email="shelf-corncob-said@duck.com" }]
|
|
8
|
+
dynamic = ["version"]
|
|
9
|
+
description = "API client for *.educabiz.com "
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = []
|
|
13
|
+
|
|
14
|
+
[project.urls]
|
|
15
|
+
Homepage = "https://github.com/fopina/python-educabiz"
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
admindocs-cli = "educabiz.__main__:cli"
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
include = ["educabiz*"]
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.dynamic]
|
|
24
|
+
version = {attr = "educabiz.__version__"}
|
|
25
|
+
|
|
26
|
+
[tool.ruff]
|
|
27
|
+
line-length = 120
|
|
28
|
+
indent-width = 4
|
|
29
|
+
|
|
30
|
+
target-version = "py310"
|
|
31
|
+
|
|
32
|
+
[tool.ruff.lint]
|
|
33
|
+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
|
34
|
+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
|
35
|
+
# McCabe complexity (`C901`) by default.
|
|
36
|
+
select = ["E4", "E7", "E9", "F", "I"]
|
|
37
|
+
ignore = []
|
|
38
|
+
|
|
39
|
+
fixable = ["ALL"]
|
|
40
|
+
unfixable = []
|
|
41
|
+
|
|
42
|
+
# Allow unused variables when underscore-prefixed.
|
|
43
|
+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
44
|
+
|
|
45
|
+
[tool.ruff.format]
|
|
46
|
+
quote-style = "single"
|
|
47
|
+
indent-style = "space"
|
|
48
|
+
skip-magic-trailing-comma = false
|
|
49
|
+
line-ending = "auto"
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
minversion = "6.0"
|
|
53
|
+
addopts = "-ra -q"
|
|
54
|
+
testpaths = [
|
|
55
|
+
"tests",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[tool.coverage.run]
|
|
59
|
+
source = ["educabiz"]
|
|
60
|
+
|
|
61
|
+
[tool.coverage.report]
|
|
62
|
+
show_missing = true
|
|
63
|
+
skip_covered = true
|
educabiz-0.0.1/setup.cfg
ADDED