Skip to content

Commit 5ca551a

Browse files
committed
Removed force_unzip -> always unzip
1 parent f16af62 commit 5ca551a

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ download(url: str, filename: str, unzip=False, unzip_path: str = None, force_dow
2727
- `unzip`: want to unzip file or just download? Requires files to be `.zip` if True. (default: False)
2828
- `unzip_path`: path to unzip files (default: current directory)
2929
- `force_download`: force files download if exist? (default: False)
30-
- `force_unzip`: force files unzip if `unzip_path` exists? (default: False)
3130
- `clean`: clean source file after unzip?
3231

3332
## Example

onedrivedownloader/main.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _create_if_not_exists(path: str, remove=True) -> None:
2626

2727
os.makedirs(path, exist_ok=True)
2828

29-
def download(url: str, filename: str, unzip=False, unzip_path: str = None, force_download=False, force_unzip=False, clean=False) -> None:
29+
def download(url: str, filename: str, unzip=False, unzip_path: str = None, force_download=False, clean=False) -> None:
3030
"""
3131
Download a file from a OneDrive url.
3232
@@ -36,7 +36,6 @@ def download(url: str, filename: str, unzip=False, unzip_path: str = None, force
3636
:param unzip: Whether to unzip the file.
3737
:param unzip_path: The path to unzip the file to. Default is current path.
3838
:param force_download: Whether to force download the file even if it already exists.
39-
:param force_unzip: Whether to force unzip the file even if it already exists.
4039
:param clean: Whether to clean the unzipped files after unzipping.
4140
"""
4241

@@ -75,15 +74,14 @@ def download(url: str, filename: str, unzip=False, unzip_path: str = None, force
7574

7675
clean_unzip_path = unzip_path is not None and os.path.realpath(unzip_path) not in os.path.realpath(filename)
7776

78-
if unzip_path is None or not os.path.exists(unzip_path) or force_unzip:
79-
print("Extracting files...")
77+
print("Extracting files...")
8078

81-
_create_if_not_exists(unzip_path, remove=clean_unzip_path)
82-
with zipfile.ZipFile(filename, 'r') as zip_ref:
83-
zip_ref.extractall(unzip_path)
79+
_create_if_not_exists(unzip_path, remove=clean_unzip_path)
80+
with zipfile.ZipFile(filename, 'r') as zip_ref:
81+
zip_ref.extractall(unzip_path)
8482

85-
if clean:
86-
os.remove(filename)
83+
if clean:
84+
os.remove(filename)
8785

8886
except Exception as e:
8987
print(e)

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
setup(
33
name='onedrivedownloader',
44
packages=['onedrivedownloader'],
5-
version='1.0.0',
5+
version='1.0.1',
66
license='MIT',
77
description='Python utility to download files through OneDrive',
88
author='Lorenzo Bonicelli',
99
author_email='[email protected]',
1010
url='https://github.com/loribonna/onedrivedownloader',
11-
download_url='https://github.com/loribonna/onedrivedownloader/archive/refs/tags/v1.0.0.zip',
11+
download_url='https://github.com/loribonna/onedrivedownloader/archive/refs/tags/v1.0.1.zip',
1212
keywords=['onedrive', 'downloader', 'python', 'utility'],
1313
install_requires=[
1414
'requests',

0 commit comments

Comments
 (0)