meteocatpy 0.0.11 → 0.0.13
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.
- package/.github/workflows/release.yml +33 -33
- package/.gitlab-ci.yml +46 -46
- package/.pre-commit-config.yaml +37 -37
- package/.releaserc +23 -23
- package/.releaserc.toml +14 -14
- package/AUTHORS.md +12 -12
- package/CHANGELOG.md +187 -171
- package/README.md +61 -61
- package/filetree.py +48 -48
- package/filetree.txt +48 -48
- package/meteocatpy/README.md +61 -61
- package/meteocatpy/__init__.py +27 -27
- package/meteocatpy/const.py +10 -10
- package/meteocatpy/data.py +93 -93
- package/meteocatpy/exceptions.py +35 -35
- package/meteocatpy/forecast.py +137 -137
- package/meteocatpy/helpers.py +46 -46
- package/meteocatpy/stations.py +71 -71
- package/meteocatpy/symbols.py +89 -89
- package/meteocatpy/town.py +61 -61
- package/meteocatpy/townstations.py +99 -99
- package/meteocatpy/variables.py +77 -77
- package/meteocatpy/version.py +2 -2
- package/package.json +23 -23
- package/poetry.lock +3313 -3313
- package/pyproject.toml +72 -72
- package/releaserc.json +17 -17
- package/requirements.test.txt +3 -3
- package/setup.cfg +64 -64
- package/setup.py +10 -10
- package/tests/data_test.py +122 -122
- package/tests/import_test.py +18 -18
- package/tests/integration_test_complete.py +76 -76
- package/tests/integration_test_forecast.py +54 -54
- package/tests/integration_test_station_data.py +33 -33
- package/tests/integration_test_stations.py +31 -31
- package/tests/integration_test_symbols.py +68 -68
- package/tests/integration_test_town.py +32 -32
- package/tests/integration_test_town_stations.py +36 -36
- package/tests/integration_test_variables.py +32 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,171 +1,187 @@
|
|
|
1
|
-
## [0.0.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* 0.0.
|
|
15
|
-
* fix cache dir ([
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
## [0.0.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### Bug Fixes
|
|
39
|
-
|
|
40
|
-
* 0.0.
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### Bug Fixes
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
1
|
+
## [0.0.13](https://github.com/figorr/meteocatpy/compare/v0.0.12...v0.0.13) (2024-12-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 0.0.13 ([1bdf3e7](https://github.com/figorr/meteocatpy/commit/1bdf3e7632156c0f033b483ac0ab5f159ed65be4))
|
|
7
|
+
* fix cache dir ([6303383](https://github.com/figorr/meteocatpy/commit/6303383e7cbf2efad27d288adf89c6ea58dbc9c4))
|
|
8
|
+
|
|
9
|
+
## [0.0.12](https://github.com/figorr/meteocatpy/compare/v0.0.11...v0.0.12) (2024-12-11)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* 0.0.12 ([81aa152](https://github.com/figorr/meteocatpy/commit/81aa1528202661eb4854e37f9b1880f798d9457e))
|
|
15
|
+
* fix cache dir ([8df49f9](https://github.com/figorr/meteocatpy/commit/8df49f97fd8f6645dae9db9f53a94a44395447ff))
|
|
16
|
+
|
|
17
|
+
## [0.0.11](https://github.com/figorr/meteocatpy/compare/v0.0.9...v0.0.10) (2024-12-10)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* 0.0.11 ([4e1d638](https://github.com/figorr/meteocatpy/commit/4e1d6387200fb6cde2d06c448c178b108bbb2b92))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [0.0.10](https://github.com/figorr/meteocatpy/compare/v0.0.9...v0.0.10) (2024-12-10)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* 0.0.10 ([93301e8](https://github.com/figorr/meteocatpy/commit/93301e82667ec85c79966da8a2b637c4d85e1b6a))
|
|
30
|
+
* 0.0.11 ([4e1d638](https://github.com/figorr/meteocatpy/commit/4e1d6387200fb6cde2d06c448c178b108bbb2b92))
|
|
31
|
+
* fix cache dir ([5c1d435](https://github.com/figorr/meteocatpy/commit/5c1d435f2310f3d0b33538f823efe64c0f3797b4))
|
|
32
|
+
* fix poetry lock ([25f32b1](https://github.com/figorr/meteocatpy/commit/25f32b1cd078ee60ab877d99fe444ccfce116f42))
|
|
33
|
+
* python 3.13 ([99390f4](https://github.com/figorr/meteocatpy/commit/99390f4745c803b9623255b39c29edf61dacfcf9))
|
|
34
|
+
|
|
35
|
+
## [0.0.9](https://github.com/figorr/meteocatpy/compare/v0.0.8...v0.0.9) (2024-12-09)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* 0.0.9 ([0cf6bf8](https://github.com/figorr/meteocatpy/commit/0cf6bf888c572c3477a1385a06a753fc0096fc95))
|
|
41
|
+
* fix cache dir ([3cafd2f](https://github.com/figorr/meteocatpy/commit/3cafd2fb0ec2fcdf9d94cf3adb3fcb264aabeb9e))
|
|
42
|
+
|
|
43
|
+
## [0.0.8](https://github.com/figorr/meteocatpy/compare/v0.0.7...v0.0.8) (2024-12-08)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* 0.0.8 ([ae21e62](https://github.com/figorr/meteocatpy/commit/ae21e62c88b1ea20b94d5feb6eb8f5dfa07de509))
|
|
49
|
+
* fix json data ([91df89c](https://github.com/figorr/meteocatpy/commit/91df89c9746588e20a2073770313de20fa8dd64b))
|
|
50
|
+
|
|
51
|
+
## [0.0.7](https://github.com/figorr/meteocatpy/compare/v0.0.6...v0.0.7) (2024-12-07)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* 0.0.7 ([7908841](https://github.com/figorr/meteocatpy/commit/7908841eee0b00b563b6b6266f4a6b71bc503ef2))
|
|
57
|
+
* add github jobs ([d61a1e8](https://github.com/figorr/meteocatpy/commit/d61a1e846a5a34b505ca4520e68152bac21ace23))
|
|
58
|
+
* add semantic-release ([cbecdd0](https://github.com/figorr/meteocatpy/commit/cbecdd05eade74445d5458100c3c42f2eaff4506))
|
|
59
|
+
* CHANGELOG.md ([6cd6655](https://github.com/figorr/meteocatpy/commit/6cd665549663377ac4a73a20c6e5d4b8f6f859b9))
|
|
60
|
+
* delete meteocat_cache ([05371e8](https://github.com/figorr/meteocatpy/commit/05371e8aa53365d5bbc027d1658e154957e225fe))
|
|
61
|
+
* fix Content-Type : application.json for headers ([a79bb1c](https://github.com/figorr/meteocatpy/commit/a79bb1ced0a1f2def294b5964840ea938c469d57))
|
|
62
|
+
* fix data recovery data ([fc93719](https://github.com/figorr/meteocatpy/commit/fc93719d7d601810771bd89dcd8715686843f836))
|
|
63
|
+
* fix gitlab jobs ([7ee5b57](https://github.com/figorr/meteocatpy/commit/7ee5b5714e27b3f9031d5b9b81fe100e1064f0da))
|
|
64
|
+
* ignore node_modules ([8b7f87c](https://github.com/figorr/meteocatpy/commit/8b7f87c5bf6b08211925824fd02dd0fdbbfced9b))
|
|
65
|
+
* ignore pytest_cache ([99e99ba](https://github.com/figorr/meteocatpy/commit/99e99baf9a79529e63a0db47c76c7b150432f566))
|
|
66
|
+
* new repo file structure ([bd7e438](https://github.com/figorr/meteocatpy/commit/bd7e438040255ddbcc375fd67469704a83bf5dfe))
|
|
67
|
+
|
|
68
|
+
## v0.0.1 (2024-11-27)
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
- Version 0.0.3
|
|
73
|
+
([`3be4659`](https://github.com/figorr/meteocatpy/commit/3be4659a5df47b942f3d24594dc1140eecb65388))
|
|
74
|
+
|
|
75
|
+
- Version 0.0.3
|
|
76
|
+
([`987d7c8`](https://github.com/figorr/meteocatpy/commit/987d7c89f770f11aa37267815b799dd90d6230be))
|
|
77
|
+
|
|
78
|
+
- Fix version 0.0.3
|
|
79
|
+
([`6caaa46`](https://github.com/figorr/meteocatpy/commit/6caaa460dbee29f10a8566e0925ceddb94e4167e))
|
|
80
|
+
|
|
81
|
+
- Version to 0.0.2
|
|
82
|
+
([`0d47a4c`](https://github.com/figorr/meteocatpy/commit/0d47a4c1d8f64d0f6b32a79b909cda79ef236825))
|
|
83
|
+
|
|
84
|
+
- 0.0.1
|
|
85
|
+
([`a840913`](https://github.com/figorr/meteocatpy/commit/a840913c7cab075bf7b242ecbf0c93c0471f27f1))
|
|
86
|
+
|
|
87
|
+
- Fix version to 0.0.2
|
|
88
|
+
([`9c1b294`](https://github.com/figorr/meteocatpy/commit/9c1b294faa060988ecf41fbebcb01345ec940dce))
|
|
89
|
+
|
|
90
|
+
- 0.0.1
|
|
91
|
+
([`304baee`](https://github.com/figorr/meteocatpy/commit/304baeef7d988b3d38a39a2064230ccf3e34e5b5))
|
|
92
|
+
|
|
93
|
+
- Version 0.0.2
|
|
94
|
+
([`94fe6d1`](https://github.com/figorr/meteocatpy/commit/94fe6d1c6637c69d38eaec6b86463e260d1faf7f))
|
|
95
|
+
|
|
96
|
+
- Python 3.12
|
|
97
|
+
([`3b41f89`](https://github.com/figorr/meteocatpy/commit/3b41f895150a335f9cce7df3932d162bd8a6ed2e))
|
|
98
|
+
|
|
99
|
+
- 0.0.1
|
|
100
|
+
([`21b136e`](https://github.com/figorr/meteocatpy/commit/21b136e53b20484ca451b8ae7ea346723e343cd0))
|
|
101
|
+
|
|
102
|
+
- New repo file structure
|
|
103
|
+
([`d4369e5`](https://github.com/figorr/meteocatpy/commit/d4369e5e3048fee4fb7edf445814f4e765178d4d))
|
|
104
|
+
|
|
105
|
+
- Set town_id as codi_municipi and variable_id as codi_variable
|
|
106
|
+
([`8cfa246`](https://github.com/figorr/meteocatpy/commit/8cfa2465a949bfd46c60d7a4d824bd41eb5af507))
|
|
107
|
+
|
|
108
|
+
- Set town_id as codi
|
|
109
|
+
([`f4f1ee4`](https://github.com/figorr/meteocatpy/commit/f4f1ee403d16620e57c02e66771aa6b3483b6a89))
|
|
110
|
+
|
|
111
|
+
- Set station_id as codiEstacio
|
|
112
|
+
([`d8d75e4`](https://github.com/figorr/meteocatpy/commit/d8d75e484c3c191e7db70a20db9ce27e2b7d182c))
|
|
113
|
+
|
|
114
|
+
- Add new classes
|
|
115
|
+
([`aebd5c1`](https://github.com/figorr/meteocatpy/commit/aebd5c1011a9ba53ddcf239fa6f6ab2c9fc052a4))
|
|
116
|
+
|
|
117
|
+
- Fix status code UnknownAPIError
|
|
118
|
+
([`d611d42`](https://github.com/figorr/meteocatpy/commit/d611d42ddc12ff792d53894ba0c8007a1a9678ab))
|
|
119
|
+
|
|
120
|
+
- Fix status code for UnknownAPIError
|
|
121
|
+
([`3f4606b`](https://github.com/figorr/meteocatpy/commit/3f4606b5ec023254cb73efb2d5cf306974533898))
|
|
122
|
+
|
|
123
|
+
- Fix README
|
|
124
|
+
([`1c5553d`](https://github.com/figorr/meteocatpy/commit/1c5553d9b430563cb35f2d53fd51b4be00bf25aa))
|
|
125
|
+
|
|
126
|
+
- Add MeteocatSymbols
|
|
127
|
+
([`f30b115`](https://github.com/figorr/meteocatpy/commit/f30b1150d0bc78908287a1ef72827590a089f003))
|
|
128
|
+
|
|
129
|
+
- Fix tests
|
|
130
|
+
([`93cdcfd`](https://github.com/figorr/meteocatpy/commit/93cdcfd753d4ab7770ae85ad7c4e035802b8e9d2))
|
|
131
|
+
|
|
132
|
+
- Set symbol categories
|
|
133
|
+
([`88a5016`](https://github.com/figorr/meteocatpy/commit/88a5016935d6103183672a79bf0423e0893cefa1))
|
|
134
|
+
|
|
135
|
+
- Include new classes
|
|
136
|
+
([`f4ce82b`](https://github.com/figorr/meteocatpy/commit/f4ce82bffef80a884e02962548d6f5da7466e3b1))
|
|
137
|
+
|
|
138
|
+
- Improved error handling
|
|
139
|
+
([`03699b7`](https://github.com/figorr/meteocatpy/commit/03699b74791db3bb695d9613a215aee3da6a9929))
|
|
140
|
+
|
|
141
|
+
- Improved error handling
|
|
142
|
+
([`786005a`](https://github.com/figorr/meteocatpy/commit/786005a43435cb2217575dd1e528ff4f5a403e35))
|
|
143
|
+
|
|
144
|
+
- Improved error handling
|
|
145
|
+
([`295b356`](https://github.com/figorr/meteocatpy/commit/295b3560864e4420008aa80cbc01c96e1fbb67f8))
|
|
146
|
+
|
|
147
|
+
- Delete test files
|
|
148
|
+
([`33f3751`](https://github.com/figorr/meteocatpy/commit/33f3751e645bda30a70475efe5404f6f4ad0f96f))
|
|
149
|
+
|
|
150
|
+
- Fix integration_test
|
|
151
|
+
([`b7e8024`](https://github.com/figorr/meteocatpy/commit/b7e8024760401537d9ad28e026d4948383d9db3e))
|
|
152
|
+
|
|
153
|
+
- Add predictions resource url
|
|
154
|
+
([`d88e457`](https://github.com/figorr/meteocatpy/commit/d88e45777671c5726859c4b817a5ea02a7462ae4))
|
|
155
|
+
|
|
156
|
+
- Add predictions to client
|
|
157
|
+
([`e292acb`](https://github.com/figorr/meteocatpy/commit/e292acb3aa68415f3dd06d8ed2030fe2b18b9cb4))
|
|
158
|
+
|
|
159
|
+
- Fix base_url
|
|
160
|
+
([`3850642`](https://github.com/figorr/meteocatpy/commit/3850642390eb85962e0ac2d13d6b72effd985f53))
|
|
161
|
+
|
|
162
|
+
- Add new dependencies
|
|
163
|
+
([`dd7ff23`](https://github.com/figorr/meteocatpy/commit/dd7ff23fc7131187dd2c82cd57c2e6bcabfcea42))
|
|
164
|
+
|
|
165
|
+
- Readme
|
|
166
|
+
([`cb7cc7f`](https://github.com/figorr/meteocatpy/commit/cb7cc7fa33a388dde7e13563bc060d8a8a7265cf))
|
|
167
|
+
|
|
168
|
+
- Readme
|
|
169
|
+
([`21d88e7`](https://github.com/figorr/meteocatpy/commit/21d88e77ea206905161f09223f2d6f265958e98d))
|
|
170
|
+
|
|
171
|
+
- Add test_client
|
|
172
|
+
([`d878f74`](https://github.com/figorr/meteocatpy/commit/d878f7403716254b49203dc8f4589177bcbabc56))
|
|
173
|
+
|
|
174
|
+
- Fix _secrets
|
|
175
|
+
([`3adf076`](https://github.com/figorr/meteocatpy/commit/3adf076060718b0445ab9ff606e396ce2974433a))
|
|
176
|
+
|
|
177
|
+
- Fix const.py
|
|
178
|
+
([`c268acc`](https://github.com/figorr/meteocatpy/commit/c268acc417d8e8a550d2d74636e35e4268802dc6))
|
|
179
|
+
|
|
180
|
+
- Fix description
|
|
181
|
+
([`7afeb64`](https://github.com/figorr/meteocatpy/commit/7afeb643c5c8d906f4a497a9d177d264d25506dd))
|
|
182
|
+
|
|
183
|
+
- Fix interface.py
|
|
184
|
+
([`6dbc4c0`](https://github.com/figorr/meteocatpy/commit/6dbc4c0a1d644e58cb8c9b69b5ff812759ab25c0))
|
|
185
|
+
|
|
186
|
+
- Add filetree
|
|
187
|
+
([`1d1fad8`](https://github.com/figorr/meteocatpy/commit/1d1fad8ee1a50757396b6fd8ba8f8c77b243e1dd))
|
package/README.md
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
# Meteocat Python Package for Meteocat Home Assistant Integration
|
|
2
|
-
|
|
3
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
|
-
[](https://pypi.org/project/meteocatpy)
|
|
5
|
-
[](https://gitlab.com/figorr/meteocatpy/commits/master)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`meteocatpy` is a Python package to interact with the Meteocat API. Allows you to obtain meteorological data and lists of municipalities from the Meteocat API.
|
|
9
|
-
|
|
10
|
-
**NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
|
|
11
|
-
|
|
12
|
-
# Installation
|
|
13
|
-
|
|
14
|
-
You can install the package from PyPI using `pip`:
|
|
15
|
-
```bash
|
|
16
|
-
pip install meteocatpy
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
from meteocatpy.client import MeteocatClient
|
|
21
|
-
|
|
22
|
-
# Replace 'tu_api_key' with your actual API key
|
|
23
|
-
api_key = "tu_api_key"
|
|
24
|
-
client = MeteocatClient(api_key)
|
|
25
|
-
|
|
26
|
-
# Get a list of municipalities (asynchronous call)
|
|
27
|
-
municipis = await client.get_municipis()
|
|
28
|
-
print(municipis)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
# Credits
|
|
32
|
-
|
|
33
|
-
This is a personal project.
|
|
34
|
-
|
|
35
|
-
Authors:
|
|
36
|
-
- Figorr
|
|
37
|
-
|
|
38
|
-
# Contributing
|
|
39
|
-
|
|
40
|
-
If you would like to contribute to this project, please open an issue or create a pull request. I'd be happy to review your contributions!
|
|
41
|
-
|
|
42
|
-
1. [Check for open features/bugs](https://gitlab.com/figorr/meteocatpy/issues)
|
|
43
|
-
or [initiate a discussion on one](https://gitlab.com/figorr/meteocatpy/issues/new).
|
|
44
|
-
2. [Fork the repository](https://gitlab.com/figorr/meteocatpy/forks/new).
|
|
45
|
-
3. Install the dev environment: `make init`.
|
|
46
|
-
4. Enter the virtual environment: `pipenv shell`
|
|
47
|
-
5. Code your new feature or bug fix.
|
|
48
|
-
6. Write a test that covers your new functionality.
|
|
49
|
-
7. Update `README.md` with any new documentation.
|
|
50
|
-
8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
|
|
51
|
-
9. Ensure you have no linting errors: `make lint`
|
|
52
|
-
10. Ensure you have typed your code correctly: `make typing`
|
|
53
|
-
11. Add yourself to `AUTHORS.md`.
|
|
54
|
-
12. Submit a pull request!
|
|
55
|
-
|
|
56
|
-
# License
|
|
57
|
-
|
|
58
|
-
[Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
|
|
59
|
-
|
|
60
|
-
# API Reference
|
|
61
|
-
|
|
1
|
+
# Meteocat Python Package for Meteocat Home Assistant Integration
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
|
+
[](https://pypi.org/project/meteocatpy)
|
|
5
|
+
[](https://gitlab.com/figorr/meteocatpy/commits/master)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
`meteocatpy` is a Python package to interact with the Meteocat API. Allows you to obtain meteorological data and lists of municipalities from the Meteocat API.
|
|
9
|
+
|
|
10
|
+
**NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
|
|
14
|
+
You can install the package from PyPI using `pip`:
|
|
15
|
+
```bash
|
|
16
|
+
pip install meteocatpy
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
from meteocatpy.client import MeteocatClient
|
|
21
|
+
|
|
22
|
+
# Replace 'tu_api_key' with your actual API key
|
|
23
|
+
api_key = "tu_api_key"
|
|
24
|
+
client = MeteocatClient(api_key)
|
|
25
|
+
|
|
26
|
+
# Get a list of municipalities (asynchronous call)
|
|
27
|
+
municipis = await client.get_municipis()
|
|
28
|
+
print(municipis)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
# Credits
|
|
32
|
+
|
|
33
|
+
This is a personal project.
|
|
34
|
+
|
|
35
|
+
Authors:
|
|
36
|
+
- Figorr
|
|
37
|
+
|
|
38
|
+
# Contributing
|
|
39
|
+
|
|
40
|
+
If you would like to contribute to this project, please open an issue or create a pull request. I'd be happy to review your contributions!
|
|
41
|
+
|
|
42
|
+
1. [Check for open features/bugs](https://gitlab.com/figorr/meteocatpy/issues)
|
|
43
|
+
or [initiate a discussion on one](https://gitlab.com/figorr/meteocatpy/issues/new).
|
|
44
|
+
2. [Fork the repository](https://gitlab.com/figorr/meteocatpy/forks/new).
|
|
45
|
+
3. Install the dev environment: `make init`.
|
|
46
|
+
4. Enter the virtual environment: `pipenv shell`
|
|
47
|
+
5. Code your new feature or bug fix.
|
|
48
|
+
6. Write a test that covers your new functionality.
|
|
49
|
+
7. Update `README.md` with any new documentation.
|
|
50
|
+
8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
|
|
51
|
+
9. Ensure you have no linting errors: `make lint`
|
|
52
|
+
10. Ensure you have typed your code correctly: `make typing`
|
|
53
|
+
11. Add yourself to `AUTHORS.md`.
|
|
54
|
+
12. Submit a pull request!
|
|
55
|
+
|
|
56
|
+
# License
|
|
57
|
+
|
|
58
|
+
[Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
|
|
59
|
+
|
|
60
|
+
# API Reference
|
|
61
|
+
|
|
62
62
|
[See the docs 📚](https://apidocs.meteocat.gencat.cat/section/informacio-general/).
|
package/filetree.py
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
def generate_file_tree():
|
|
5
|
-
# Ruta donde se generará el archivo
|
|
6
|
-
output_file = 'filetree.txt'
|
|
7
|
-
|
|
8
|
-
# Ejecutar el comando git ls-files para obtener los archivos no ignorados
|
|
9
|
-
git_command = ['git', 'ls-files']
|
|
10
|
-
try:
|
|
11
|
-
# Captura de la salida del comando git
|
|
12
|
-
git_files = subprocess.check_output(git_command).decode('utf-8').splitlines()
|
|
13
|
-
|
|
14
|
-
# Crear una estructura de árbol
|
|
15
|
-
tree = {}
|
|
16
|
-
|
|
17
|
-
# Construir el árbol de directorios
|
|
18
|
-
for file in git_files:
|
|
19
|
-
parts = file.split('/') # Separar la ruta del archivo por '/'
|
|
20
|
-
current = tree
|
|
21
|
-
for part in parts[:-1]: # Recorremos todos los directorios
|
|
22
|
-
current = current.setdefault(part, {})
|
|
23
|
-
current[parts[-1]] = None # El archivo final se marca como 'None'
|
|
24
|
-
|
|
25
|
-
# Función recursiva para imprimir el árbol con la indentación correcta
|
|
26
|
-
def print_tree(directory, indent=""):
|
|
27
|
-
for name, subdirectory in directory.items():
|
|
28
|
-
if subdirectory is None:
|
|
29
|
-
# Si es un archivo, lo imprimimos
|
|
30
|
-
f.write(f"{indent}├── {name}\n")
|
|
31
|
-
else:
|
|
32
|
-
# Si es un directorio, lo imprimimos y recursivamente llamamos a print_tree
|
|
33
|
-
f.write(f"{indent}└── {name}/\n")
|
|
34
|
-
print_tree(subdirectory, indent + " ")
|
|
35
|
-
|
|
36
|
-
# Crear el archivo y escribir la estructura del árbol con codificación UTF-8
|
|
37
|
-
with open(output_file, 'w', encoding='utf-8') as f:
|
|
38
|
-
print_tree(tree)
|
|
39
|
-
|
|
40
|
-
print(f"Árbol de directorios generado en: {os.path.abspath(output_file)}")
|
|
41
|
-
|
|
42
|
-
except subprocess.CalledProcessError as e:
|
|
43
|
-
print(f"Error al ejecutar el comando: {e}")
|
|
44
|
-
except Exception as e:
|
|
45
|
-
print(f"Ocurrió un error inesperado: {e}")
|
|
46
|
-
|
|
47
|
-
if __name__ == "__main__":
|
|
48
|
-
generate_file_tree()
|
|
1
|
+
import subprocess
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
def generate_file_tree():
|
|
5
|
+
# Ruta donde se generará el archivo
|
|
6
|
+
output_file = 'filetree.txt'
|
|
7
|
+
|
|
8
|
+
# Ejecutar el comando git ls-files para obtener los archivos no ignorados
|
|
9
|
+
git_command = ['git', 'ls-files']
|
|
10
|
+
try:
|
|
11
|
+
# Captura de la salida del comando git
|
|
12
|
+
git_files = subprocess.check_output(git_command).decode('utf-8').splitlines()
|
|
13
|
+
|
|
14
|
+
# Crear una estructura de árbol
|
|
15
|
+
tree = {}
|
|
16
|
+
|
|
17
|
+
# Construir el árbol de directorios
|
|
18
|
+
for file in git_files:
|
|
19
|
+
parts = file.split('/') # Separar la ruta del archivo por '/'
|
|
20
|
+
current = tree
|
|
21
|
+
for part in parts[:-1]: # Recorremos todos los directorios
|
|
22
|
+
current = current.setdefault(part, {})
|
|
23
|
+
current[parts[-1]] = None # El archivo final se marca como 'None'
|
|
24
|
+
|
|
25
|
+
# Función recursiva para imprimir el árbol con la indentación correcta
|
|
26
|
+
def print_tree(directory, indent=""):
|
|
27
|
+
for name, subdirectory in directory.items():
|
|
28
|
+
if subdirectory is None:
|
|
29
|
+
# Si es un archivo, lo imprimimos
|
|
30
|
+
f.write(f"{indent}├── {name}\n")
|
|
31
|
+
else:
|
|
32
|
+
# Si es un directorio, lo imprimimos y recursivamente llamamos a print_tree
|
|
33
|
+
f.write(f"{indent}└── {name}/\n")
|
|
34
|
+
print_tree(subdirectory, indent + " ")
|
|
35
|
+
|
|
36
|
+
# Crear el archivo y escribir la estructura del árbol con codificación UTF-8
|
|
37
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
|
38
|
+
print_tree(tree)
|
|
39
|
+
|
|
40
|
+
print(f"Árbol de directorios generado en: {os.path.abspath(output_file)}")
|
|
41
|
+
|
|
42
|
+
except subprocess.CalledProcessError as e:
|
|
43
|
+
print(f"Error al ejecutar el comando: {e}")
|
|
44
|
+
except Exception as e:
|
|
45
|
+
print(f"Ocurrió un error inesperado: {e}")
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
generate_file_tree()
|