From 7848968fa133f583d40fe523a9e2e8d2fa9312a5 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Tue, 11 Apr 2023 22:15:36 +0200 Subject: [PATCH] Organisation class in a folder --- .gitignore | 1 + import_export_canalblog.py | 11 ++++++----- WPExport.py => lib/WPExport.py | 0 WPImport.py => lib/WPImport.py | 0 lib/__init__.py | 0 5 files changed, 7 insertions(+), 5 deletions(-) rename WPExport.py => lib/WPExport.py (100%) rename WPImport.py => lib/WPImport.py (100%) create mode 100644 lib/__init__.py diff --git a/.gitignore b/.gitignore index 6280820..1dfd775 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ backup/ backup1/ web_scrap.log +__pycache__/ diff --git a/import_export_canalblog.py b/import_export_canalblog.py index 785fbfd..6470699 100644 --- a/import_export_canalblog.py +++ b/import_export_canalblog.py @@ -3,7 +3,8 @@ from requests.auth import HTTPBasicAuth from getpass import getpass from urllib.parse import urlparse import argparse, logging -import WPImport, WPExport +from lib.WPImport import WPimport +from lib.WPExport import WPExport if __name__ == '__main__': @@ -71,7 +72,7 @@ if __name__ == '__main__': basic = HTTPBasicAuth(args.user, password) wordpress = args.wordpress.split(",") - importWp = WPImport.WPimport(basic, "", logger, args.parser) + importWp = WPimport(basic, "", logger, args.parser) if len(args.file) > 0: for i in wordpress: importWp.setUrl(i) @@ -93,11 +94,11 @@ if __name__ == '__main__': importWp.fromDirectory(directory[i]) exit(0) if len(args.canalblog) > 0: - exportWp = WPExport.WPExport("", logger, args.parser, args.directory) + exportWp = WPExport("", logger, args.parser, args.directory) canalblog = args.canalblog.split(",") wordpress = args.wordpress.split(",") - if serial is False: + if args.serial is False: for canal in canalblog: try: o = urlparse(canal) @@ -132,7 +133,7 @@ if __name__ == '__main__': if args.command == "export": canalblog = args.url.split(",") - exportWp = WPExport.WPExport("", logger, args.parser, args.directory) + exportWp = WPExport("", logger, args.parser, args.directory) for canal in canalblog: try: o = urlparse(canal) diff --git a/WPExport.py b/lib/WPExport.py similarity index 100% rename from WPExport.py rename to lib/WPExport.py diff --git a/WPImport.py b/lib/WPImport.py similarity index 100% rename from WPImport.py rename to lib/WPImport.py diff --git a/lib/__init__.py b/lib/__init__.py new file mode 100644 index 0000000..e69de29