From 094c2baea15930862200b1a865c37f90be6208e6 Mon Sep 17 00:00:00 2001 From: bunny Date: Sat, 21 Oct 2023 01:51:17 +0530 Subject: [PATCH] Updated --- .gitignore | 7 ------- README.md | 3 ++- WeTransferTool/main_module.py | 24 ++++++++++++++++++++++++ setup.py | 7 +++++-- 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 WeTransferTool/main_module.py diff --git a/.gitignore b/.gitignore index 8b7981e..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +0,0 @@ -dist/WeTransferTool-0.3.tar.gz -dist/WeTransferTool-0.4.tar.gz -WeTransferTool.egg-info/dependency_links.txt -WeTransferTool.egg-info/PKG-INFO -WeTransferTool.egg-info/requires.txt -WeTransferTool.egg-info/SOURCES.txt -WeTransferTool.egg-info/top_level.txt diff --git a/README.md b/README.md index f7d7748..d0f56eb 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,13 @@ pip install WeTransferTool Terminal use: ``` $> wetransfertool -h -usage: wetransfertool [-h] [-dl DL] [-ul UL] +usage: wetransfertool [-h] [-dl DL] [-ul UL] [-mw MW] options: -h, --help show this help message and exit -dl DL Wetransfer file URL -ul UL File/Folder path + -mw MW Maximum number of workers (parallel uploads) ``` API use: diff --git a/WeTransferTool/main_module.py b/WeTransferTool/main_module.py new file mode 100644 index 0000000..a4d6d67 --- /dev/null +++ b/WeTransferTool/main_module.py @@ -0,0 +1,24 @@ +import argparse +from WeTransferTool import We +import json + +def main_func(): + parser = argparse.ArgumentParser() + wet = We() + + parser.add_argument('-dl', help="Wetransfer file URL", type=str) + parser.add_argument('-ul', help="File/Folder path", type=str) + parser.add_argument('-mw', help="Maximum number of workers (parallel downloads)", type=int, default=10) + args = parser.parse_args() + dl = args.dl + ul = args.ul + mw = args.mw + if not dl and not ul: + print("Need atleast one argument. Try wetransfertool -h") + if ul: + print(json.dumps(wet.upload(path=ul, max_workers=mw), indent=4)) + if dl: + wet.download(dl) + +# if __name__=="__main__": +# main_func() \ No newline at end of file diff --git a/setup.py b/setup.py index 0798476..980ee9c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name = 'WeTransferTool', # How you named your package folder (MyLib) packages = ['WeTransferTool'], # Chose the same as "name" - version = '0.5', # Start with a small number and increase it with every change you make + version = '0.7', # Start with a small number and increase it with every change you make license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository description = 'WeTransfer unofficial API wrapper written in python facilitating features like uploading and downloading files and folders', # Give a short description about your library long_description=long_description, @@ -17,5 +17,8 @@ keywords = ['api', 'wetransfer', 'wrapper', 'upload', 'download'], # Keywords that define your package best install_requires=[ # I get to this in a second 'requests', - ] + ], + entry_points = { + 'console_scripts': ['wetransfertool=WeTransferTool.main_module:main_func'], + } ) \ No newline at end of file