mirror of
https://github.com/guezoloic/millesima_projetS6.git
synced 2026-03-28 11:03:41 +00:00
ajout: ajout fonction main
This commit is contained in:
12
main.py
12
main.py
@@ -5,10 +5,16 @@ from os.path import normpath, join
|
||||
from sys import argv
|
||||
from pandas import read_csv, DataFrame
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main() -> None:
|
||||
if len(argv) != 2:
|
||||
raise ValueError(f"{argv[0]} <subdir>")
|
||||
raise ValueError(f"{argv[0]} <filename.csv>")
|
||||
|
||||
path: str = normpath(join(getcwd(), argv[1]))
|
||||
db: DataFrame = read_csv(path)
|
||||
print(db.all())
|
||||
print(db.all())
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print(f"ERREUR: {e}")
|
||||
@@ -1,6 +1,6 @@
|
||||
requests==2.32.5
|
||||
requests-mock==1.12.1
|
||||
beautifulsoup4==4.14.3
|
||||
pytest==9.0.2
|
||||
pytest==8.4.2
|
||||
requests-mock==1.12.1
|
||||
pandas==3.0.0
|
||||
pandas==2.3.3
|
||||
16
scraper.py
16
scraper.py
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from sys import argv
|
||||
from typing import cast
|
||||
@@ -357,7 +357,15 @@ class Scraper:
|
||||
f.flush()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main() -> None:
|
||||
if len(argv) != 2:
|
||||
raise ValueError(f"{argv[0]} <subdir>")
|
||||
Scraper().getvins(argv[1], "donnee.csv")
|
||||
raise ValueError(f"{argv[0]} <sous-url>")
|
||||
scraper: Scraper = Scraper()
|
||||
scraper.getvins(argv[1], "donnee.csv")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print(f"ERREUR: {e}")
|
||||
|
||||
Reference in New Issue
Block a user