canvas-download 1.1.5__py3-none-any.whl → 1.1.7__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.
@@ -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
- full_path = Path(folder.full_name)
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
- for file in folder.get_files():
103
- if file.locked:
104
- continue
105
- file_path = folder_path / get_valid_filename(file.display_name)
106
- if not file_path.exists():
107
- file.download(str(file_path))
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 | ResourceDoesNotExist as err:
112
+ print(err)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canvas-download
3
- Version: 1.1.5
3
+ Version: 1.1.7
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=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,,
@@ -1,7 +0,0 @@
1
- canvas_download/__init__.py,sha256=UYMprX3e0pTWVOXVUNEa0no_Fp0T4sLV5hVQ-LTtm-A,33
2
- canvas_download/canvas_download.py,sha256=bVjlJap3VYywqpAiY_1i9OE-skMEIn0bYiAv0kEp7WI,4046
3
- canvas_download-1.1.5.dist-info/METADATA,sha256=CCsaYV9ALJ3G-NcdGUoe6aERDOSf0yQN8VcOAoRVx04,1979
4
- canvas_download-1.1.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
- canvas_download-1.1.5.dist-info/entry_points.txt,sha256=BxAmz6cqp2vls7uVmWnkbq1Dek5VrXqLE3vSU9Ozu1M,57
6
- canvas_download-1.1.5.dist-info/licenses/LICENSE.txt,sha256=5chfP2IKlCssxQ6-2ISz9dbWt-d33GN5K1eS9SAUdto,1069
7
- canvas_download-1.1.5.dist-info/RECORD,,