canvas-download 1.1.7__py3-none-any.whl → 1.1.8__py3-none-any.whl
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/canvas_download.py +18 -9
- {canvas_download-1.1.7.dist-info → canvas_download-1.1.8.dist-info}/METADATA +1 -1
- canvas_download-1.1.8.dist-info/RECORD +7 -0
- canvas_download-1.1.7.dist-info/RECORD +0 -7
- {canvas_download-1.1.7.dist-info → canvas_download-1.1.8.dist-info}/WHEEL +0 -0
- {canvas_download-1.1.7.dist-info → canvas_download-1.1.8.dist-info}/entry_points.txt +0 -0
- {canvas_download-1.1.7.dist-info → canvas_download-1.1.8.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -9,7 +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
|
+
from canvasapi.exceptions import Forbidden, ResourceDoesNotExist
|
|
13
13
|
from tqdm import tqdm
|
|
14
14
|
|
|
15
15
|
if sys.platform == "win32":
|
|
@@ -85,12 +85,18 @@ def main():
|
|
|
85
85
|
for module in course.get_modules():
|
|
86
86
|
module_path = course_path / get_valid_filename(module.name)
|
|
87
87
|
module_path.mkdir(parents=True, exist_ok=True)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
try:
|
|
89
|
+
for item in module.get_module_items():
|
|
90
|
+
if item.type == "File":
|
|
91
|
+
file_path = module_path / get_valid_filename(item.title)
|
|
92
|
+
if not file_path.exists():
|
|
93
|
+
file = course.get_file(item.content_id)
|
|
94
|
+
try:
|
|
95
|
+
file.download(str(file_path))
|
|
96
|
+
except ResourceDoesNotExist as err:
|
|
97
|
+
print(err)
|
|
98
|
+
except Forbidden as err:
|
|
99
|
+
print(err)
|
|
94
100
|
elif user_choice == "files":
|
|
95
101
|
for folder in course.get_folders():
|
|
96
102
|
folder_name = folder.full_name
|
|
@@ -107,6 +113,9 @@ def main():
|
|
|
107
113
|
continue
|
|
108
114
|
file_path = folder_path / get_valid_filename(file.display_name)
|
|
109
115
|
if not file_path.exists():
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
try:
|
|
117
|
+
file.download(str(file_path))
|
|
118
|
+
except ResourceDoesNotExist as err:
|
|
119
|
+
print(err)
|
|
120
|
+
except Forbidden as err:
|
|
112
121
|
print(err)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: canvas-download
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.8
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
canvas_download/__init__.py,sha256=UYMprX3e0pTWVOXVUNEa0no_Fp0T4sLV5hVQ-LTtm-A,33
|
|
2
|
+
canvas_download/canvas_download.py,sha256=wRj13xRN1CGaiq544Dpv6sYhiKqF_2mQv92CZfxzyqA,4739
|
|
3
|
+
canvas_download-1.1.8.dist-info/METADATA,sha256=PD6eB0n_0G6WhZzUA282eDOG3LBx871sRu9942yJjCU,1979
|
|
4
|
+
canvas_download-1.1.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
+
canvas_download-1.1.8.dist-info/entry_points.txt,sha256=BxAmz6cqp2vls7uVmWnkbq1Dek5VrXqLE3vSU9Ozu1M,57
|
|
6
|
+
canvas_download-1.1.8.dist-info/licenses/LICENSE.txt,sha256=5chfP2IKlCssxQ6-2ISz9dbWt-d33GN5K1eS9SAUdto,1069
|
|
7
|
+
canvas_download-1.1.8.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
canvas_download/__init__.py,sha256=UYMprX3e0pTWVOXVUNEa0no_Fp0T4sLV5hVQ-LTtm-A,33
|
|
2
|
-
canvas_download/canvas_download.py,sha256=E5lZ3A9yPPychssO7eGueHdeAsz9gHsHnv9nS-6e8i0,4287
|
|
3
|
-
canvas_download-1.1.7.dist-info/METADATA,sha256=_Fj8IGJzH-5AZy9skuiTpSNOwnHa1boVR1jhangvXEA,1979
|
|
4
|
-
canvas_download-1.1.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
-
canvas_download-1.1.7.dist-info/entry_points.txt,sha256=BxAmz6cqp2vls7uVmWnkbq1Dek5VrXqLE3vSU9Ozu1M,57
|
|
6
|
-
canvas_download-1.1.7.dist-info/licenses/LICENSE.txt,sha256=5chfP2IKlCssxQ6-2ISz9dbWt-d33GN5K1eS9SAUdto,1069
|
|
7
|
-
canvas_download-1.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|