pyIntradel 0.0.2__tar.gz → 0.0.4__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.
- pyintradel-0.0.4/PKG-INFO +130 -0
- pyintradel-0.0.4/README.md +101 -0
- pyintradel-0.0.4/pyIntradel.egg-info/PKG-INFO +130 -0
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/pyIntradel.egg-info/SOURCES.txt +6 -1
- pyintradel-0.0.4/pyIntradel.egg-info/top_level.txt +1 -0
- pyintradel-0.0.4/pyintradel/__init__.py +1 -0
- pyintradel-0.0.4/pyintradel/api/__init__.py +33 -0
- pyintradel-0.0.4/pyintradel/api/parser.py +77 -0
- pyintradel-0.0.4/pyintradel/api/towns.py +75 -0
- pyintradel-0.0.4/pyintradel/main.py +25 -0
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/setup.py +1 -1
- pyIntradel-0.0.2/PKG-INFO +0 -54
- pyIntradel-0.0.2/README.md +0 -37
- pyIntradel-0.0.2/pyIntradel.egg-info/PKG-INFO +0 -54
- pyIntradel-0.0.2/pyIntradel.egg-info/top_level.txt +0 -1
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/LICENSE +0 -0
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/pyIntradel.egg-info/dependency_links.txt +0 -0
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/pyIntradel.egg-info/not-zip-safe +0 -0
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/pyIntradel.egg-info/requires.txt +0 -0
- {pyIntradel-0.0.2 → pyintradel-0.0.4}/setup.cfg +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyIntradel
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Python interface for Intradel
|
|
5
|
+
Home-page: https://github.com/thomasgermain/pyintradel.git
|
|
6
|
+
Author: Thomas Germain
|
|
7
|
+
Author-email: 12560542+thomasgermain@users.noreply.github.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Topic :: Home Automation
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: aiohttp<4.0.0,>=3.8.0
|
|
18
|
+
Requires-Dist: beautifulsoup4<5.0.0,>=4.11.0
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# pyIntradel
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
A python connector for waste collection for province of Liège. This connector is using screen scraping to collect
|
|
37
|
+
following data (for the current year), in json:
|
|
38
|
+
- "Green bin" (organic waste) and "black bin" residual waste
|
|
39
|
+
- Total weight
|
|
40
|
+
- Number of collections
|
|
41
|
+
- details of all the collections
|
|
42
|
+
- chip number
|
|
43
|
+
- starting date (01/01 of the current year)
|
|
44
|
+
- Recypark
|
|
45
|
+
- details of all the visits
|
|
46
|
+
- (01/01 of the current year)
|
|
47
|
+
|
|
48
|
+
Here is an example of json:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
[
|
|
52
|
+
{
|
|
53
|
+
"name": "ORGANIQUE",
|
|
54
|
+
"start_date": "01-01-2022",
|
|
55
|
+
"id": "123456",
|
|
56
|
+
"details":
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
"date": "20-01-2022",
|
|
60
|
+
"detail": "34.0"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"date": "17-02-2022",
|
|
64
|
+
"detail": "27.0"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"date": "07-04-2022",
|
|
68
|
+
"detail": "36.0"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"total": "97"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "RESIDUEL",
|
|
75
|
+
"start_date": "01-01-2022",
|
|
76
|
+
"id": "78810",
|
|
77
|
+
"details":
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
"date": "20-01-2022",
|
|
81
|
+
"detail": "14.5"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"date": "07-04-2022",
|
|
85
|
+
"detail": "11.5"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"date": "21-04-2022",
|
|
89
|
+
"detail": "11.5"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"total": "37.5"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "RECYPARC",
|
|
96
|
+
"start_date": "01-01-2022",
|
|
97
|
+
"id": "RECYPARC",
|
|
98
|
+
"details":
|
|
99
|
+
[
|
|
100
|
+
{
|
|
101
|
+
"date": "14-04-2022",
|
|
102
|
+
"detail": "Encombrants (0.35 m³), Petits Bruns (0.00 pièce)"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"total": "1"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Usage
|
|
111
|
+
|
|
112
|
+
The `town` parameter is the name of the town, you can check it here: [towns](pyintradel/api/towns.py)
|
|
113
|
+
|
|
114
|
+
### Python module
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import aiohttp
|
|
118
|
+
from pyintradel import api
|
|
119
|
+
|
|
120
|
+
async with aiohttp.ClientSession() as sess:
|
|
121
|
+
await api.get_data(sess, login, password, town)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Command line
|
|
125
|
+
```bash
|
|
126
|
+
python3 main.py user passw town
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
<a href="https://www.buymeacoffee.com/tgermain" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# pyIntradel
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
A python connector for waste collection for province of Liège. This connector is using screen scraping to collect
|
|
8
|
+
following data (for the current year), in json:
|
|
9
|
+
- "Green bin" (organic waste) and "black bin" residual waste
|
|
10
|
+
- Total weight
|
|
11
|
+
- Number of collections
|
|
12
|
+
- details of all the collections
|
|
13
|
+
- chip number
|
|
14
|
+
- starting date (01/01 of the current year)
|
|
15
|
+
- Recypark
|
|
16
|
+
- details of all the visits
|
|
17
|
+
- (01/01 of the current year)
|
|
18
|
+
|
|
19
|
+
Here is an example of json:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
"name": "ORGANIQUE",
|
|
25
|
+
"start_date": "01-01-2022",
|
|
26
|
+
"id": "123456",
|
|
27
|
+
"details":
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
"date": "20-01-2022",
|
|
31
|
+
"detail": "34.0"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"date": "17-02-2022",
|
|
35
|
+
"detail": "27.0"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "07-04-2022",
|
|
39
|
+
"detail": "36.0"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"total": "97"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "RESIDUEL",
|
|
46
|
+
"start_date": "01-01-2022",
|
|
47
|
+
"id": "78810",
|
|
48
|
+
"details":
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
"date": "20-01-2022",
|
|
52
|
+
"detail": "14.5"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"date": "07-04-2022",
|
|
56
|
+
"detail": "11.5"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"date": "21-04-2022",
|
|
60
|
+
"detail": "11.5"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"total": "37.5"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "RECYPARC",
|
|
67
|
+
"start_date": "01-01-2022",
|
|
68
|
+
"id": "RECYPARC",
|
|
69
|
+
"details":
|
|
70
|
+
[
|
|
71
|
+
{
|
|
72
|
+
"date": "14-04-2022",
|
|
73
|
+
"detail": "Encombrants (0.35 m³), Petits Bruns (0.00 pièce)"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"total": "1"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
The `town` parameter is the name of the town, you can check it here: [towns](pyintradel/api/towns.py)
|
|
84
|
+
|
|
85
|
+
### Python module
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import aiohttp
|
|
89
|
+
from pyintradel import api
|
|
90
|
+
|
|
91
|
+
async with aiohttp.ClientSession() as sess:
|
|
92
|
+
await api.get_data(sess, login, password, town)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Command line
|
|
96
|
+
```bash
|
|
97
|
+
python3 main.py user passw town
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
<a href="https://www.buymeacoffee.com/tgermain" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyIntradel
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Python interface for Intradel
|
|
5
|
+
Home-page: https://github.com/thomasgermain/pyintradel.git
|
|
6
|
+
Author: Thomas Germain
|
|
7
|
+
Author-email: 12560542+thomasgermain@users.noreply.github.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Topic :: Home Automation
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: aiohttp<4.0.0,>=3.8.0
|
|
18
|
+
Requires-Dist: beautifulsoup4<5.0.0,>=4.11.0
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# pyIntradel
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
A python connector for waste collection for province of Liège. This connector is using screen scraping to collect
|
|
37
|
+
following data (for the current year), in json:
|
|
38
|
+
- "Green bin" (organic waste) and "black bin" residual waste
|
|
39
|
+
- Total weight
|
|
40
|
+
- Number of collections
|
|
41
|
+
- details of all the collections
|
|
42
|
+
- chip number
|
|
43
|
+
- starting date (01/01 of the current year)
|
|
44
|
+
- Recypark
|
|
45
|
+
- details of all the visits
|
|
46
|
+
- (01/01 of the current year)
|
|
47
|
+
|
|
48
|
+
Here is an example of json:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
[
|
|
52
|
+
{
|
|
53
|
+
"name": "ORGANIQUE",
|
|
54
|
+
"start_date": "01-01-2022",
|
|
55
|
+
"id": "123456",
|
|
56
|
+
"details":
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
"date": "20-01-2022",
|
|
60
|
+
"detail": "34.0"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"date": "17-02-2022",
|
|
64
|
+
"detail": "27.0"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"date": "07-04-2022",
|
|
68
|
+
"detail": "36.0"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"total": "97"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "RESIDUEL",
|
|
75
|
+
"start_date": "01-01-2022",
|
|
76
|
+
"id": "78810",
|
|
77
|
+
"details":
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
"date": "20-01-2022",
|
|
81
|
+
"detail": "14.5"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"date": "07-04-2022",
|
|
85
|
+
"detail": "11.5"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"date": "21-04-2022",
|
|
89
|
+
"detail": "11.5"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"total": "37.5"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "RECYPARC",
|
|
96
|
+
"start_date": "01-01-2022",
|
|
97
|
+
"id": "RECYPARC",
|
|
98
|
+
"details":
|
|
99
|
+
[
|
|
100
|
+
{
|
|
101
|
+
"date": "14-04-2022",
|
|
102
|
+
"detail": "Encombrants (0.35 m³), Petits Bruns (0.00 pièce)"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"total": "1"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Usage
|
|
111
|
+
|
|
112
|
+
The `town` parameter is the name of the town, you can check it here: [towns](pyintradel/api/towns.py)
|
|
113
|
+
|
|
114
|
+
### Python module
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import aiohttp
|
|
118
|
+
from pyintradel import api
|
|
119
|
+
|
|
120
|
+
async with aiohttp.ClientSession() as sess:
|
|
121
|
+
await api.get_data(sess, login, password, town)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Command line
|
|
125
|
+
```bash
|
|
126
|
+
python3 main.py user passw town
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
<a href="https://www.buymeacoffee.com/tgermain" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|
|
@@ -7,4 +7,9 @@ pyIntradel.egg-info/SOURCES.txt
|
|
|
7
7
|
pyIntradel.egg-info/dependency_links.txt
|
|
8
8
|
pyIntradel.egg-info/not-zip-safe
|
|
9
9
|
pyIntradel.egg-info/requires.txt
|
|
10
|
-
pyIntradel.egg-info/top_level.txt
|
|
10
|
+
pyIntradel.egg-info/top_level.txt
|
|
11
|
+
pyintradel/__init__.py
|
|
12
|
+
pyintradel/main.py
|
|
13
|
+
pyintradel/api/__init__.py
|
|
14
|
+
pyintradel/api/parser.py
|
|
15
|
+
pyintradel/api/towns.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyintradel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""pyIntradel"""
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""pyIntradel"""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
import aiohttp
|
|
7
|
+
|
|
8
|
+
from . import parser
|
|
9
|
+
from . import towns
|
|
10
|
+
|
|
11
|
+
logging.basicConfig(level=logging.INFO, format="%(asctime)s:%(levelname)s:%(name)s: %(message)s")
|
|
12
|
+
|
|
13
|
+
_LOGGER = logging.getLogger(__name__)
|
|
14
|
+
_URL = "https://www.intradel.be/particulier/"
|
|
15
|
+
_HEADERS = {"Content-Type": "application/x-www-form-urlencoded"}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
async def get_data(
|
|
19
|
+
session: aiohttp.ClientSession, login: str, password: str, town: str
|
|
20
|
+
) -> list[Any]:
|
|
21
|
+
_LOGGER.info("Will query data for user %s and city %s", login, town)
|
|
22
|
+
|
|
23
|
+
town_id = towns.TOWNS_MAP.get(town.upper())
|
|
24
|
+
if not town_id:
|
|
25
|
+
ValueError("Town not found", town)
|
|
26
|
+
|
|
27
|
+
data = {"llogin": "YES", "login": login, "pass": password, "commune": town_id}
|
|
28
|
+
|
|
29
|
+
async with session.post(_URL, data=data, headers=_HEADERS) as resp:
|
|
30
|
+
if resp.status != 200:
|
|
31
|
+
raise ValueError(f"Received error {resp.status}", await resp.text())
|
|
32
|
+
else:
|
|
33
|
+
return parser.parse(await resp.text())
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict
|
|
4
|
+
|
|
5
|
+
from bs4 import BeautifulSoup
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def parse(response: str) -> list[Any]:
|
|
9
|
+
"""Parse response from intradel"""
|
|
10
|
+
results = []
|
|
11
|
+
soup = BeautifulSoup(response, features="html.parser")
|
|
12
|
+
|
|
13
|
+
if soup.find(attrs={"name": "pLogin"}) is not None:
|
|
14
|
+
raise ValueError("Wrong response received, login/password seems incorrect", response)
|
|
15
|
+
|
|
16
|
+
content = (
|
|
17
|
+
soup.find(attrs={"class": "grid"})
|
|
18
|
+
.find(attrs={"class": "row"})
|
|
19
|
+
.findChildren(attrs={"class": "post__content"})
|
|
20
|
+
)
|
|
21
|
+
for data in content:
|
|
22
|
+
result: Dict[str, Any] = {}
|
|
23
|
+
if data.find(name="h3") is not None:
|
|
24
|
+
name = _name(data)
|
|
25
|
+
start_date = _start_date(data)
|
|
26
|
+
chip_id = _chip_id(data) or name
|
|
27
|
+
details = _details(data)
|
|
28
|
+
total = _total(data) or str(len(details))
|
|
29
|
+
|
|
30
|
+
result.update({"name": name})
|
|
31
|
+
result.update({"start_date": start_date})
|
|
32
|
+
result.update({"id": chip_id})
|
|
33
|
+
result.update({"details": details})
|
|
34
|
+
result.update({"total": total})
|
|
35
|
+
results.append(result)
|
|
36
|
+
|
|
37
|
+
return results
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _name(data: BeautifulSoup) -> str:
|
|
41
|
+
return str(data.find(name="h3").text.strip())
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _start_date(data: BeautifulSoup) -> str:
|
|
45
|
+
info = data.findAll(name="p")
|
|
46
|
+
start_date = info[0]
|
|
47
|
+
if len(info) > 1:
|
|
48
|
+
start_date = info[3]
|
|
49
|
+
|
|
50
|
+
return str(start_date.text.split(":")[1].strip())
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _chip_id(data: BeautifulSoup) -> str | None:
|
|
54
|
+
chip_id = None
|
|
55
|
+
possible_chip_id = data.findChildren(name="p")
|
|
56
|
+
if len(possible_chip_id) > 1:
|
|
57
|
+
chip_id = str(data.findChildren(name="p")[1].text.split(":")[1].strip())
|
|
58
|
+
return chip_id
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _details(data: BeautifulSoup) -> list[Any]:
|
|
62
|
+
attrs = []
|
|
63
|
+
for row in data.find(name="tbody").findChildren(name="tr"):
|
|
64
|
+
tds = row.findAll(name="td")
|
|
65
|
+
# When the list is empty, the website still includes an empty row.
|
|
66
|
+
# Let's just skip empty rows, as a valid row needs a date anyway.
|
|
67
|
+
if tds[0].text:
|
|
68
|
+
attrs.append({"date": tds[0].text, "detail": tds[2].text})
|
|
69
|
+
return attrs
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _total(data: BeautifulSoup) -> str | None:
|
|
73
|
+
total = None
|
|
74
|
+
possible_total = data.find(name="tfoot").findChildren("td")
|
|
75
|
+
if possible_total:
|
|
76
|
+
total = str(possible_total[2].text.split(" ")[0].strip())
|
|
77
|
+
return total
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
TOWNS_MAP = {
|
|
2
|
+
"AMAY": "26",
|
|
3
|
+
"ANS": "590",
|
|
4
|
+
"ANTHISNES": "3",
|
|
5
|
+
"AUBEL": "589",
|
|
6
|
+
"AWANS": "8",
|
|
7
|
+
"AYWAILLE": "9",
|
|
8
|
+
"BAELEN": "588",
|
|
9
|
+
"BASSENGE": "591",
|
|
10
|
+
"BERLOZ": "2",
|
|
11
|
+
"BEYNE": "592",
|
|
12
|
+
"BLEGNY": "581",
|
|
13
|
+
"BRAIVES": "10",
|
|
14
|
+
"BURDINNE": "577",
|
|
15
|
+
"CHAUDFONTAINE": "584",
|
|
16
|
+
"CLAVIER": "27",
|
|
17
|
+
"COMBLAIN-AU-PONT": "30",
|
|
18
|
+
"CRISNÉE": "593",
|
|
19
|
+
"DALHEM": "594",
|
|
20
|
+
"DEMO_BERLOZ": "580",
|
|
21
|
+
"DISON": "595",
|
|
22
|
+
"DONCEEL": "596",
|
|
23
|
+
"ENGIS": "7",
|
|
24
|
+
"ESNEUX": "6",
|
|
25
|
+
"EUPEN": "597",
|
|
26
|
+
"FAIMES": "4",
|
|
27
|
+
"FERRIÈRES": "583",
|
|
28
|
+
"FEXHE": "11",
|
|
29
|
+
"FLEMALLE": "36",
|
|
30
|
+
"FLERON": "21",
|
|
31
|
+
"GEER": "29",
|
|
32
|
+
"GRACE-HOLLOGNE": "32",
|
|
33
|
+
"HAMOIR": "5",
|
|
34
|
+
"HANNUT": "12",
|
|
35
|
+
"HERSTAL": "38",
|
|
36
|
+
"HERVE": "13",
|
|
37
|
+
"HUY": "598",
|
|
38
|
+
"JALHAY": "599",
|
|
39
|
+
"JUPRELLE": "600",
|
|
40
|
+
"KELMIS": "601",
|
|
41
|
+
"LIEGE": "576",
|
|
42
|
+
"LIMBOURG": "602",
|
|
43
|
+
"LINCENT": "28",
|
|
44
|
+
"LONTZEN": "603",
|
|
45
|
+
"MARCHIN": "14",
|
|
46
|
+
"MODAVE": "15",
|
|
47
|
+
"NANDRIN": "35",
|
|
48
|
+
"NEUPRÉ": "604",
|
|
49
|
+
"OLNE": "587",
|
|
50
|
+
"OREYE": "16",
|
|
51
|
+
"OUFFET": "582",
|
|
52
|
+
"OUPEYE": "579",
|
|
53
|
+
"PEPINSTER": "22",
|
|
54
|
+
"PLOMBIÈRES": "586",
|
|
55
|
+
"RAEREN": "605",
|
|
56
|
+
"REMICOURT": "17",
|
|
57
|
+
"SAINT-GEORGES-SUR-MEUSE": "33",
|
|
58
|
+
"SAINT-NICOLAS": "25",
|
|
59
|
+
"SERAING": "24",
|
|
60
|
+
"SOUMAGNE": "606",
|
|
61
|
+
"SPA": "23",
|
|
62
|
+
"SPRIMONT": "18",
|
|
63
|
+
"THEUX": "607",
|
|
64
|
+
"THIMISTER": "608",
|
|
65
|
+
"TINLOT": "609",
|
|
66
|
+
"TROOZ": "37",
|
|
67
|
+
"VERLAINE": "610",
|
|
68
|
+
"VERVIERS": "611",
|
|
69
|
+
"VILLERS": "612",
|
|
70
|
+
"VISÉ": "613",
|
|
71
|
+
"WANZE": "19",
|
|
72
|
+
"WAREMME": "20",
|
|
73
|
+
"WASSEIGES": "1",
|
|
74
|
+
"WELKENRAEDT": "585",
|
|
75
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import aiohttp
|
|
6
|
+
|
|
7
|
+
import api
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
async def _main(login: str, password: str, town: str) -> None:
|
|
11
|
+
async with aiohttp.ClientSession() as sess:
|
|
12
|
+
json.dump(await api.get_data(sess, login, password, town), sys.stdout, indent=2)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
if not len(sys.argv) == 4:
|
|
17
|
+
print("Usage: python3 api.py user pass town")
|
|
18
|
+
sys.exit(0)
|
|
19
|
+
user_param = sys.argv[1]
|
|
20
|
+
passw_param = sys.argv[2]
|
|
21
|
+
town_param = sys.argv[3]
|
|
22
|
+
|
|
23
|
+
loop = asyncio.new_event_loop()
|
|
24
|
+
asyncio.set_event_loop(loop)
|
|
25
|
+
loop.run_until_complete(_main(user_param, passw_param, town_param))
|
|
@@ -8,7 +8,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="pyIntradel",
|
|
11
|
-
version="0.0.
|
|
11
|
+
version="0.0.4",
|
|
12
12
|
description="Python interface for Intradel",
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
14
14
|
long_description=long_description,
|
pyIntradel-0.0.2/PKG-INFO
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pyIntradel
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: Python interface for Intradel
|
|
5
|
-
Home-page: https://github.com/thomasgermain/pyintradel.git
|
|
6
|
-
Author: Thomas Germain
|
|
7
|
-
Author-email: 12560542+thomasgermain@users.noreply.github.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Programming Language :: Python
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Topic :: Home Automation
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
|
|
18
|
-
# pyIntradel
|
|
19
|
-
|
|
20
|
-

|
|
21
|
-

|
|
22
|
-

|
|
23
|
-
|
|
24
|
-
A python connector for waste collection for province of Liège. This connector is using screen scraping to collect
|
|
25
|
-
following data (for the current year)
|
|
26
|
-
- "Green bin" (organic waste) and "black bin" residual waste
|
|
27
|
-
- Total weight
|
|
28
|
-
- Number of collections
|
|
29
|
-
- details of all the collections
|
|
30
|
-
- chip number
|
|
31
|
-
- starting date (01/01 of the current year)
|
|
32
|
-
- Recypark
|
|
33
|
-
- details of all the visits
|
|
34
|
-
- (01/01 of the current year)
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
The `town` parameter is the name of the town, you can check it here: [towns](pyintradel/api/towns.py)
|
|
39
|
-
|
|
40
|
-
### Python module
|
|
41
|
-
|
|
42
|
-
```python
|
|
43
|
-
import aiohttp
|
|
44
|
-
from pyintradel import api
|
|
45
|
-
|
|
46
|
-
async with aiohttp.ClientSession() as sess:
|
|
47
|
-
await api.get_data(sess, login, password, town)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Command line
|
|
51
|
-
```bash
|
|
52
|
-
python3 api.py user passw town
|
|
53
|
-
```
|
|
54
|
-
|
pyIntradel-0.0.2/README.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# pyIntradel
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
A python connector for waste collection for province of Liège. This connector is using screen scraping to collect
|
|
8
|
-
following data (for the current year)
|
|
9
|
-
- "Green bin" (organic waste) and "black bin" residual waste
|
|
10
|
-
- Total weight
|
|
11
|
-
- Number of collections
|
|
12
|
-
- details of all the collections
|
|
13
|
-
- chip number
|
|
14
|
-
- starting date (01/01 of the current year)
|
|
15
|
-
- Recypark
|
|
16
|
-
- details of all the visits
|
|
17
|
-
- (01/01 of the current year)
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
The `town` parameter is the name of the town, you can check it here: [towns](pyintradel/api/towns.py)
|
|
22
|
-
|
|
23
|
-
### Python module
|
|
24
|
-
|
|
25
|
-
```python
|
|
26
|
-
import aiohttp
|
|
27
|
-
from pyintradel import api
|
|
28
|
-
|
|
29
|
-
async with aiohttp.ClientSession() as sess:
|
|
30
|
-
await api.get_data(sess, login, password, town)
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Command line
|
|
34
|
-
```bash
|
|
35
|
-
python3 api.py user passw town
|
|
36
|
-
```
|
|
37
|
-
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pyIntradel
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: Python interface for Intradel
|
|
5
|
-
Home-page: https://github.com/thomasgermain/pyintradel.git
|
|
6
|
-
Author: Thomas Germain
|
|
7
|
-
Author-email: 12560542+thomasgermain@users.noreply.github.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Programming Language :: Python
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Topic :: Home Automation
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
|
|
18
|
-
# pyIntradel
|
|
19
|
-
|
|
20
|
-

|
|
21
|
-

|
|
22
|
-

|
|
23
|
-
|
|
24
|
-
A python connector for waste collection for province of Liège. This connector is using screen scraping to collect
|
|
25
|
-
following data (for the current year)
|
|
26
|
-
- "Green bin" (organic waste) and "black bin" residual waste
|
|
27
|
-
- Total weight
|
|
28
|
-
- Number of collections
|
|
29
|
-
- details of all the collections
|
|
30
|
-
- chip number
|
|
31
|
-
- starting date (01/01 of the current year)
|
|
32
|
-
- Recypark
|
|
33
|
-
- details of all the visits
|
|
34
|
-
- (01/01 of the current year)
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
The `town` parameter is the name of the town, you can check it here: [towns](pyintradel/api/towns.py)
|
|
39
|
-
|
|
40
|
-
### Python module
|
|
41
|
-
|
|
42
|
-
```python
|
|
43
|
-
import aiohttp
|
|
44
|
-
from pyintradel import api
|
|
45
|
-
|
|
46
|
-
async with aiohttp.ClientSession() as sess:
|
|
47
|
-
await api.get_data(sess, login, password, town)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Command line
|
|
51
|
-
```bash
|
|
52
|
-
python3 api.py user passw town
|
|
53
|
-
```
|
|
54
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|