canvas-download 1.0.0__tar.gz → 1.1.0__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.0/PKG-INFO +37 -0
- canvas_download-1.1.0/README.md +9 -0
- canvas_download-1.1.0/pyproject.toml +42 -0
- {canvas_download-1.0.0 → canvas_download-1.1.0}/src/canvas_download/canvas_download.py +30 -13
- canvas_download-1.0.0/PKG-INFO +0 -25
- canvas_download-1.0.0/README.md +0 -8
- canvas_download-1.0.0/pyproject.toml +0 -31
- {canvas_download-1.0.0 → canvas_download-1.1.0}/.gitignore +0 -0
- {canvas_download-1.0.0 → canvas_download-1.1.0}/LICENSE.txt +0 -0
- {canvas_download-1.0.0 → canvas_download-1.1.0}/src/canvas_download/__init__.py +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: canvas-download
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Downloads Canvas modules/files into a local directory.
|
|
5
|
+
Project-URL: Homepage, https://github.com/suncloudsmoon/canvas-download
|
|
6
|
+
Project-URL: Issues, https://github.com/suncloudsmoon/canvas-download/issues
|
|
7
|
+
Author-email: suncloudsmoon <farsaturn@outlook.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE.txt
|
|
10
|
+
Keywords: canvas,canvas-grab,download,downloader,offline,sync,utility
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: canvasapi>=3.3.0
|
|
25
|
+
Requires-Dist: pywin32; platform_system == 'Windows'
|
|
26
|
+
Requires-Dist: tqdm>=4.67.1
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# canvas-download
|
|
30
|
+
canvas-download downloads Canvas modules/files into a local directory for offline access. A file called 'login.json' under the '.config' directory will be created during the first run of the utility, which will require you to fill out the details of your Canvas login credentials. In the second run of the application, '.config/courses.json' will be created by the application and allows you to choose whether to download "files" or "modules" for each course. After those details are filled out, you can simply call 'canvas-download' in the terminal to start the process of downloading files from Canvas.
|
|
31
|
+
|
|
32
|
+
# How to install
|
|
33
|
+
```
|
|
34
|
+
pip install canvas-download
|
|
35
|
+
```
|
|
36
|
+
# Support
|
|
37
|
+
If you encounter any particular issue with this application, feel free to reach out by opening an issue.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# canvas-download
|
|
2
|
+
canvas-download downloads Canvas modules/files into a local directory for offline access. A file called 'login.json' under the '.config' directory will be created during the first run of the utility, which will require you to fill out the details of your Canvas login credentials. In the second run of the application, '.config/courses.json' will be created by the application and allows you to choose whether to download "files" or "modules" for each course. After those details are filled out, you can simply call 'canvas-download' in the terminal to start the process of downloading files from Canvas.
|
|
3
|
+
|
|
4
|
+
# How to install
|
|
5
|
+
```
|
|
6
|
+
pip install canvas-download
|
|
7
|
+
```
|
|
8
|
+
# Support
|
|
9
|
+
If you encounter any particular issue with this application, feel free to reach out by opening an issue.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling >= 1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
dependencies = [
|
|
7
|
+
"canvasapi >= 3.3.0",
|
|
8
|
+
"tqdm >= 4.67.1",
|
|
9
|
+
"pywin32; platform_system == 'Windows'"
|
|
10
|
+
]
|
|
11
|
+
name = "canvas-download"
|
|
12
|
+
version = "1.1.0"
|
|
13
|
+
authors = [
|
|
14
|
+
{name="suncloudsmoon", email="farsaturn@outlook.com"}
|
|
15
|
+
]
|
|
16
|
+
description = "Downloads Canvas modules/files into a local directory."
|
|
17
|
+
keywords = ["canvas", "download", "canvas-grab", "sync", "utility", "downloader", "canvas", "offline"]
|
|
18
|
+
readme="README.md"
|
|
19
|
+
requires-python = ">= 3.10"
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 5 - Production/Stable",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Environment :: Console",
|
|
30
|
+
"License :: OSI Approved :: MIT License",
|
|
31
|
+
"Topic :: Utilities",
|
|
32
|
+
"Intended Audience :: Education"
|
|
33
|
+
]
|
|
34
|
+
license = "MIT"
|
|
35
|
+
license-files = ["LICEN[CS]E*"]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/suncloudsmoon/canvas-download"
|
|
39
|
+
Issues = "https://github.com/suncloudsmoon/canvas-download/issues"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
canvas-download = "canvas_download:main"
|
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
3
|
-
{
|
|
4
|
-
"API_URL": "",
|
|
5
|
-
"API_KEY": ""
|
|
6
|
-
}
|
|
2
|
+
canvas-download allows you to download files from canvas with a single command.
|
|
7
3
|
"""
|
|
8
4
|
|
|
9
5
|
import json
|
|
10
6
|
import re
|
|
7
|
+
import sys
|
|
11
8
|
from datetime import datetime, timezone
|
|
12
9
|
from pathlib import Path
|
|
13
10
|
|
|
14
11
|
from canvasapi import Canvas
|
|
15
12
|
from tqdm import tqdm
|
|
16
13
|
|
|
14
|
+
if sys.platform == "win32":
|
|
15
|
+
import win32api
|
|
16
|
+
import win32con
|
|
17
|
+
|
|
17
18
|
|
|
18
19
|
def get_valid_filename(filename: str):
|
|
19
|
-
return re.sub(r'[<>:"\|\\/\?\*]', " ", filename).strip()
|
|
20
|
+
return re.sub(r'[<>:"\|\\/\?\*]', " ", filename).strip().strip(".")
|
|
21
|
+
|
|
20
22
|
|
|
21
23
|
def main():
|
|
22
|
-
|
|
24
|
+
config_dir = Path(".config")
|
|
25
|
+
login_path = config_dir / "login.json"
|
|
26
|
+
if not courses_path.exists():
|
|
27
|
+
courses_path.mkdir()
|
|
28
|
+
if sys.platform == "win32":
|
|
29
|
+
win32api.SetFileAttributes(str(config_dir), win32con.FILE_ATTRIBUTE_HIDDEN)
|
|
30
|
+
|
|
31
|
+
contents = json.dumps({"API_URL": "", "API_KEY": ""}, indent=4)
|
|
32
|
+
login_path.write_text(contents, encoding="utf-8")
|
|
33
|
+
print(
|
|
34
|
+
f"Fill out the details of your canvas login credentials at {login_path} and relaunch this application to continue. Note: '.config' directory is hidden."
|
|
35
|
+
)
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
contents = login_path.read_text(encoding="utf-8")
|
|
23
39
|
login = json.loads(contents)
|
|
24
40
|
canvas = Canvas(login["API_URL"], login["API_KEY"])
|
|
25
41
|
|
|
@@ -34,22 +50,23 @@ def main():
|
|
|
34
50
|
if not current_courses:
|
|
35
51
|
raise LookupError("no enrolled courses found")
|
|
36
52
|
|
|
37
|
-
|
|
53
|
+
courses_path = config_dir / "courses.json"
|
|
38
54
|
names_courses = {
|
|
39
55
|
re.search(r"\w\S+-\S+\w", course.name).group(0).replace("-", " "): course
|
|
40
56
|
for course in current_courses
|
|
41
57
|
}
|
|
42
|
-
if not
|
|
58
|
+
if not courses_path.exists():
|
|
43
59
|
config = {k: "modules" for k in names_courses}
|
|
44
|
-
|
|
60
|
+
courses_path.write_text(json.dumps(config, indent=4), encoding="utf-8")
|
|
45
61
|
print("Welcome to canvas sync...")
|
|
46
62
|
print("config.json has been created; change settings if needed")
|
|
47
63
|
else:
|
|
48
|
-
contents =
|
|
64
|
+
contents = courses_path.read_text(encoding="utf-8")
|
|
49
65
|
config = json.loads(contents)
|
|
50
66
|
# config validation
|
|
51
67
|
if not all(name in config for name in names_courses) or not all(
|
|
52
|
-
val.lower() == "modules" or val.lower() == "files"
|
|
68
|
+
val.lower() == "modules" or val.lower() == "files"
|
|
69
|
+
for val in config.values()
|
|
53
70
|
):
|
|
54
71
|
raise ValueError("invalid config")
|
|
55
72
|
|
|
@@ -80,4 +97,4 @@ def main():
|
|
|
80
97
|
continue
|
|
81
98
|
file_path = folder_path / get_valid_filename(file.display_name)
|
|
82
99
|
if not file_path.exists():
|
|
83
|
-
file.download(str(file_path))
|
|
100
|
+
file.download(str(file_path))
|
canvas_download-1.0.0/PKG-INFO
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: canvas-download
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: Automatically downloads Canvas modules/files into a local directory.
|
|
5
|
-
Project-URL: Homepage, https://github.com/suncloudsmoon/canvas-download
|
|
6
|
-
Project-URL: Issues, https://github.com/suncloudsmoon/canvas-download/issues
|
|
7
|
-
Author-email: suncloudsmoon <farsaturn@outlook.com>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
License-File: LICENSE.txt
|
|
10
|
-
Keywords: canvas,canvas-grab,download
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Requires-Python: >=3.10
|
|
14
|
-
Requires-Dist: canvasapi>=3.3.0
|
|
15
|
-
Requires-Dist: tqdm>=4.67.1
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
|
|
18
|
-
# canvas-download
|
|
19
|
-
Canvas Download automatically downloads Canvas modules/files into a local directory for offline access. A file called config.json will be created during the first run of the utility and no files will be downloaded in this run. config.json will define whether to download "files" or "modules" for a particular course. To use this command line utility, create the following files as listed below in the same directory as you want the canvas files to be downloaded to.
|
|
20
|
-
|
|
21
|
-
## login.json
|
|
22
|
-
{
|
|
23
|
-
"API_URL": "",
|
|
24
|
-
"API_KEY": ""
|
|
25
|
-
}
|
canvas_download-1.0.0/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# canvas-download
|
|
2
|
-
Canvas Download automatically downloads Canvas modules/files into a local directory for offline access. A file called config.json will be created during the first run of the utility and no files will be downloaded in this run. config.json will define whether to download "files" or "modules" for a particular course. To use this command line utility, create the following files as listed below in the same directory as you want the canvas files to be downloaded to.
|
|
3
|
-
|
|
4
|
-
## login.json
|
|
5
|
-
{
|
|
6
|
-
"API_URL": "",
|
|
7
|
-
"API_KEY": ""
|
|
8
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling >= 1.27"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
dependencies = [
|
|
7
|
-
"canvasapi >= 3.3.0",
|
|
8
|
-
"tqdm >= 4.67.1"
|
|
9
|
-
]
|
|
10
|
-
name = "canvas-download"
|
|
11
|
-
version = "1.0.0"
|
|
12
|
-
authors = [
|
|
13
|
-
{name="suncloudsmoon", email="farsaturn@outlook.com"}
|
|
14
|
-
]
|
|
15
|
-
description = "Automatically downloads Canvas modules/files into a local directory."
|
|
16
|
-
keywords = ["canvas", "download", "canvas-grab"]
|
|
17
|
-
readme="README.md"
|
|
18
|
-
requires-python = ">= 3.10"
|
|
19
|
-
classifiers = [
|
|
20
|
-
"Programming Language :: Python :: 3",
|
|
21
|
-
"Operating System :: OS Independent",
|
|
22
|
-
]
|
|
23
|
-
license = "MIT"
|
|
24
|
-
license-files = ["LICEN[CS]E*"]
|
|
25
|
-
|
|
26
|
-
[project.urls]
|
|
27
|
-
Homepage = "https://github.com/suncloudsmoon/canvas-download"
|
|
28
|
-
Issues = "https://github.com/suncloudsmoon/canvas-download/issues"
|
|
29
|
-
|
|
30
|
-
[project.scripts]
|
|
31
|
-
canvas-download = "canvas_download:main"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|