edb-noumea 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl

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.
edb_noumea/details.py CHANGED
@@ -21,10 +21,10 @@ def get_pdf_url():
21
21
  return get_latest_pdf_url()
22
22
 
23
23
  import pandas as pd
24
+ import pdfplumber
24
25
  import requests
25
26
  import io
26
27
  from bs4 import BeautifulSoup
27
- import pdfplumber
28
28
 
29
29
  # URL de la page officielle contenant le lien vers le PDF
30
30
  PAGE_URL = "https://www.noumea.nc/noumea-pratique/salubrite-publique/qualite-eaux-baignade"
@@ -78,21 +78,27 @@ def get_detailed_results():
78
78
  try:
79
79
  print("🔍 Extraction des tableaux du PDF avec pdfplumber...")
80
80
  with pdfplumber.open(pdf_file) as pdf:
81
+ if not pdf.pages:
82
+ print("❌ Le PDF ne contient aucune page.")
83
+ return None
84
+
81
85
  first_page = pdf.pages[0]
82
86
  tables = first_page.extract_tables()
87
+
88
+ if not tables:
89
+ print("❌ Aucun tableau n'a été trouvé dans le PDF.")
90
+ return None
91
+
92
+ print(f"✅ {len(tables)} tableau(x) trouvé(s) sur la première page.")
93
+ # Convertir le premier tableau en DataFrame
94
+ table_data = tables[0]
95
+ df = pd.DataFrame(table_data[1:], columns=table_data[0])
96
+
83
97
  except Exception as e:
84
- print(f"❌ Une erreur est survenue lors de l'extraction des données du PDF avec pdfplumber.")
98
+ print(f"❌ Une erreur est survenue lors de l'extraction des données du PDF.")
85
99
  print(f" Erreur originale : {e}")
86
100
  return None
87
101
 
88
- if not tables:
89
- print("❌ Aucun tableau n'a été trouvé dans le PDF.")
90
- return None
91
-
92
- # Assuming the first table is the one we want
93
- df = pd.DataFrame(tables[0][1:], columns=tables[0][0])
94
-
95
- print(f"✅ {len(tables)} tableau(x) trouvé(s). Affichage du premier.")
96
102
  print("\n--- Aperçu du tableau extrait (toutes colonnes) ---")
97
103
  with pd.option_context('display.max_columns', None):
98
104
  print(df)
@@ -174,6 +180,6 @@ if __name__ == "__main__":
174
180
  "e_coli_npp_100ml",
175
181
  "enterocoques_npp_100ml"
176
182
  ]])
177
- # Export CSV avec toutes les colonnes
178
- detailed_df.to_csv("details_dernier_releve_full.csv", index=False)
179
- print("\n✅ Export CSV : details_dernier_releve_full.csv")
183
+ # Export CSV
184
+ detailed_df.to_csv("details_dernier_releve.csv", index=False)
185
+ print("\n✅ Export CSV : details_dernier_releve.csv")
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edb-noumea
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Scraper robuste pour la qualité des eaux de baignade à Nouméa. Ajout export CSV automatique et détection améliorée des colonnes PDF.
5
5
  Project-URL: Homepage, https://github.com/adriens/edb-noumea
6
6
  Project-URL: Repository, https://github.com/adriens/edb-noumea
7
+ License-File: LICENSE
7
8
  Requires-Dist: requests
8
9
  Requires-Dist: beautifulsoup4
9
10
  Requires-Dist: pandas
10
11
  Requires-Dist: lxml
11
12
  Requires-Dist: pdfplumber
12
13
  Requires-Dist: matplotlib
14
+ Dynamic: license-file
@@ -0,0 +1,8 @@
1
+ edb_noumea/__init__.py,sha256=G7WKTGLsr2wtW1E2jYpqq4miZLoSGhTifSE36CGNkLo,60
2
+ edb_noumea/details.py,sha256=R0lnEeYL1C-BKPaJhySq3N1H1sFZ4yNOkEcKP3g59dg,8026
3
+ edb_noumea/main.py,sha256=KWT0ZGrHlbhEsQxi_Rw0Mm1syDIxoY-Px1yab94IbJc,2115
4
+ edb_noumea-0.3.2.dist-info/licenses/LICENSE,sha256=mNQ0SS064BtPKYHabMRg2yM3m-GDX4MgDQ6ZnDFiueI,1100
5
+ edb_noumea-0.3.2.dist-info/METADATA,sha256=WBWP0xNI2e8txiTvqCetbQeMNuPS0lj8QF251zW3JqA,518
6
+ edb_noumea-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ edb_noumea-0.3.2.dist-info/top_level.txt,sha256=Dj3JusM0b5H9_f9yZeO-IwucCZzI1OHSjLMKtvRjq6k,11
8
+ edb_noumea-0.3.2.dist-info/RECORD,,
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Adrien SALES x.com/rastadidi dev.to/adriens
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.
@@ -1,7 +0,0 @@
1
- edb_noumea/__init__.py,sha256=G7WKTGLsr2wtW1E2jYpqq4miZLoSGhTifSE36CGNkLo,60
2
- edb_noumea/details.py,sha256=bWPv-S1iipW_XqDcZAmDtrMxUc54Fju82Z5Q2JdHnJU,7829
3
- edb_noumea/main.py,sha256=KWT0ZGrHlbhEsQxi_Rw0Mm1syDIxoY-Px1yab94IbJc,2115
4
- edb_noumea-0.3.1.dist-info/METADATA,sha256=FcC2Ty-sfhQvToFm05luy3_yDCTJbasasquE-VoVhuM,474
5
- edb_noumea-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- edb_noumea-0.3.1.dist-info/top_level.txt,sha256=Dj3JusM0b5H9_f9yZeO-IwucCZzI1OHSjLMKtvRjq6k,11
7
- edb_noumea-0.3.1.dist-info/RECORD,,