canvas-download 1.1.5__tar.gz → 1.1.6__tar.gz
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.
- {canvas_download-1.1.5 → canvas_download-1.1.6}/PKG-INFO +1 -1
- {canvas_download-1.1.5 → canvas_download-1.1.6}/pyproject.toml +1 -1
- {canvas_download-1.1.5 → canvas_download-1.1.6}/src/canvas_download/canvas_download.py +12 -7
- {canvas_download-1.1.5 → canvas_download-1.1.6}/.gitignore +0 -0
- {canvas_download-1.1.5 → canvas_download-1.1.6}/LICENSE.txt +0 -0
- {canvas_download-1.1.5 → canvas_download-1.1.6}/README.md +0 -0
- {canvas_download-1.1.5 → canvas_download-1.1.6}/src/canvas_download/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: canvas-download
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.6
|
|
4
4
|
Summary: Downloads Canvas modules/files into a local directory.
|
|
5
5
|
Project-URL: Homepage, https://github.com/suncloudsmoon/canvas-download
|
|
6
6
|
Project-URL: Issues, https://github.com/suncloudsmoon/canvas-download/issues
|
|
@@ -9,6 +9,7 @@ from datetime import datetime, timezone
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
11
|
from canvasapi import Canvas
|
|
12
|
+
from canvasapi.exceptions import Forbidden
|
|
12
13
|
from tqdm import tqdm
|
|
13
14
|
|
|
14
15
|
if sys.platform == "win32":
|
|
@@ -92,16 +93,20 @@ def main():
|
|
|
92
93
|
file.download(str(file_path))
|
|
93
94
|
elif user_choice == "files":
|
|
94
95
|
for folder in course.get_folders():
|
|
95
|
-
|
|
96
|
+
folder_name = folder.full_name
|
|
97
|
+
full_path = Path(folder_name)
|
|
96
98
|
folder_path = (
|
|
97
99
|
course_path / full_path.relative_to(full_path.parts[0])
|
|
98
100
|
if full_path.parts[0] == "course files"
|
|
99
101
|
else None
|
|
100
102
|
)
|
|
101
103
|
folder_path.mkdir(parents=True, exist_ok=True)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
try:
|
|
105
|
+
for file in folder.get_files():
|
|
106
|
+
if file.locked:
|
|
107
|
+
continue
|
|
108
|
+
file_path = folder_path / get_valid_filename(file.display_name)
|
|
109
|
+
if not file_path.exists():
|
|
110
|
+
file.download(str(file_path))
|
|
111
|
+
except Forbidden as err:
|
|
112
|
+
print(err)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|