permisapi-client 0.3.0__tar.gz → 0.4.0__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.
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/PKG-INFO +1 -1
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/permisapi_client/client.py +18 -0
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/pyproject.toml +1 -1
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/tests/test_client.py +22 -0
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/.gitignore +0 -0
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/README.md +0 -0
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/permisapi_client/__init__.py +0 -0
- {permisapi_client-0.3.0 → permisapi_client-0.4.0}/permisapi_client/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: permisapi-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Client Python officiel pour PermisAPI : permis de construire France en API REST.
|
|
5
5
|
Project-URL: Homepage, https://permisapi.fr
|
|
6
6
|
Project-URL: Documentation, https://permisapi.fr/docs
|
|
@@ -130,6 +130,20 @@ class _PermitsResource:
|
|
|
130
130
|
params["max_distance"] = max_distance
|
|
131
131
|
return self._c._get(f"/v1/permits/{num_pa}/dvf", params=params or None)
|
|
132
132
|
|
|
133
|
+
def score_mdb(self, num_pa: str) -> dict[str, Any]:
|
|
134
|
+
"""GET /v1/permits/{num_pa}/score : Score Opportunité MDB v0.1.
|
|
135
|
+
|
|
136
|
+
Plans Pro et superieurs uniquement (402 si Free / Explorer).
|
|
137
|
+
Retourne {num_pa, permit_id, score (0-100), tier (low/medium/
|
|
138
|
+
high/premium), components (7 signaux ponderes), weights,
|
|
139
|
+
version, method, dvf_matches_used, density_class}.
|
|
140
|
+
|
|
141
|
+
Algo : heuristique ponderee qui combine type permit, surface,
|
|
142
|
+
DVF voisin €/m², activite dep, demandeur (SCI vs promoteur),
|
|
143
|
+
coherence DVF/permit, densite INSEE.
|
|
144
|
+
"""
|
|
145
|
+
return self._c._get(f"/v1/permits/{num_pa}/score")
|
|
146
|
+
|
|
133
147
|
def export(
|
|
134
148
|
self,
|
|
135
149
|
*,
|
|
@@ -405,6 +419,10 @@ class _AsyncPermitsResource:
|
|
|
405
419
|
params["max_distance"] = max_distance
|
|
406
420
|
return await self._c._get(f"/v1/permits/{num_pa}/dvf", params=params or None)
|
|
407
421
|
|
|
422
|
+
async def score_mdb(self, num_pa: str) -> dict[str, Any]:
|
|
423
|
+
"""GET /v1/permits/{num_pa}/score : version async. Plans Pro+ only."""
|
|
424
|
+
return await self._c._get(f"/v1/permits/{num_pa}/score")
|
|
425
|
+
|
|
408
426
|
async def export(
|
|
409
427
|
self,
|
|
410
428
|
*,
|
|
@@ -302,6 +302,28 @@ def test_permits_export_403_for_explorer_plan() -> None:
|
|
|
302
302
|
client.permits.export()
|
|
303
303
|
|
|
304
304
|
|
|
305
|
+
@respx.mock
|
|
306
|
+
def test_permits_score_mdb() -> None:
|
|
307
|
+
respx.get(f"{BASE}/v1/permits/PC-1/score").respond(
|
|
308
|
+
json={"num_pa": "PC-1", "score": 78, "tier": "high", "components": {}}
|
|
309
|
+
)
|
|
310
|
+
with PermisAPI(api_key="pk_test_abc") as client:
|
|
311
|
+
result = client.permits.score_mdb("PC-1")
|
|
312
|
+
assert result["score"] == 78
|
|
313
|
+
assert result["tier"] == "high"
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
@pytest.mark.asyncio
|
|
317
|
+
@respx.mock
|
|
318
|
+
async def test_async_permits_score_mdb() -> None:
|
|
319
|
+
respx.get(f"{BASE}/v1/permits/PC-A/score").respond(
|
|
320
|
+
json={"num_pa": "PC-A", "score": 42, "tier": "medium"}
|
|
321
|
+
)
|
|
322
|
+
async with AsyncPermisAPI(api_key="pk_test_abc") as client:
|
|
323
|
+
result = await client.permits.score_mdb("PC-A")
|
|
324
|
+
assert result["score"] == 42
|
|
325
|
+
|
|
326
|
+
|
|
305
327
|
@pytest.mark.asyncio
|
|
306
328
|
@respx.mock
|
|
307
329
|
async def test_async_permits_export() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|