canvas-download 1.1.6__tar.gz → 1.1.8__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.
@@ -0,0 +1,3 @@
1
+ **/__pycache__
2
+ dist/
3
+ .DS_Store
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canvas-download
3
- Version: 1.1.6
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
@@ -9,7 +9,7 @@ dependencies = [
9
9
  "pywin32; platform_system == 'Windows'"
10
10
  ]
11
11
  name = "canvas-download"
12
- version = "1.1.6"
12
+ version = "1.1.8"
13
13
  authors = [
14
14
  {name="suncloudsmoon", email="farsaturn@outlook.com"}
15
15
  ]
@@ -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
- for item in module.get_module_items():
89
- if item.type == "File":
90
- file_path = module_path / get_valid_filename(item.title)
91
- if not file_path.exists():
92
- file = course.get_file(item.content_id)
93
- file.download(str(file_path))
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
- file.download(str(file_path))
116
+ try:
117
+ file.download(str(file_path))
118
+ except ResourceDoesNotExist as err:
119
+ print(err)
111
120
  except Forbidden as err:
112
121
  print(err)
@@ -1,5 +0,0 @@
1
- **/__pycache__
2
- dist/
3
- login.json
4
- config.json
5
- .DS_Store