canvas命令行客户机(按指令)

clanvas的Python项目详细描述


Clanvas on PyPIBuild Status

克兰瓦斯

Canvas Learning Management System的命令行shell客户机

Clanvas Screenshot

可用命令

在clanvas shell中,系统上已有的所有命令PATH都可用。 你可以lsgrep随意。

此外,shell还提供以下命令:

CommandMeaning
lclist classes
ccchange current class
lalist assignments
lglist grades
lannlist announcements
catannprint announcements
pullfpull course files
uaupload submission to assignment
wopenopen in web interface
whoamishow login info
quitquit the shell

键入help查看所有命令,并使用-h标志显示任何特定命令的使用详细信息。

安装

clanvas位于PyPi上,可以使用pip安装。

Clanvas需要Python3.6+

pip install clanvas

clanvas命令现在应该在您的路径上!

使用还需要generating a Canvas API token用于登录。

注意:为了获得100%正确的行编辑和制表符完成支持,可能需要进一步配置。

clanvas依赖于GNU readline或等效库提供的功能。情况因系统而异。

Linux^{} is most likely already installed, no further configuration required.
macOSApple ships it's operating system with the BSD-licensed ^{} since ^{} is released under a GPL (copyleft) license. By default, Clanvas will try to use ^{} if this is what is available. However, certain features like navigating previous commands and tab completion may not work correctly in all cases. The best/recommended solution is to ensure you are using Python with ^{}. See GNU readline on macOS for more details.
WindowsCurrently Windows is untested, but the we recommend installing the ^{} Python module.

登录

通过提供配置项或url启动clanvas shell。

例如,使用位于~/.clanvas/config的以下配置文件…

Host school
	Url https://canvas.school.edu
	Token bOYc5cOIldA3eB9NTr7X0Um9Z8TPMACb0HtdgHTMtp10T5UKH0b4HOqTmOCvWZlYRpJ9dN

…登录可以使用主机名school

$ clanvas school 
bmr23@canvas.school.edu:~:~ $

否则,如果可以提供URL,则会提示您输入访问令牌:

$ clanvas https://canvas.school.edu
Enter access token: 

有关访问令牌的详细信息,请参见Generating an API Token

示例用法

运行命令

bmr23@canvas.school.edu:~:~ $ lc -l
EECS 325  7832  Spring 2018  Computer Networks (100/5013)
EECS 338  6939  Spring 2018  Operating Systems (100/4593)
EECS 391  7136  Spring 2018  Artificial Intelligence (100/4163)
EECS 345  6937  Spring 2018  Programming Language Concepts (100/4699)
bmr23@canvas.school.edu:~:~ $ cc 325
bmr23@canvas.school.edu:EECS 325:~ $ lg -g
Computer Networks (100/5013)
├── Quizzes
│   ├── Quiz 1 100/100 100%
│   ├── Quiz 2 85/100 85%
│   └── Quiz 3 95/100 95%
├── Exams
│   └── Exam 1 86/100 86%
└── Homework
    ├── HW 1 20/20 100%
    ├── HW 2 18/20 90%
    └── HW 3 17/20 85%
bmr23@canvas.school.edu:EECS 325:~ $ pullf
bmr23@canvas.school.edu:EECS 325:~ $ tree ~/canvas/courses/EECS325-7832/files
/home/bob/canvas/courses/EECS325-7832/files
├── HW1_2018S.pdf
├── HW2_2018S.pdf
├── HW3-2018S.pdf
├── HW Solutions
│   └── HW1_2018S_Solutions
├── Lecture Notes
│   ├── Lecture1.ppt
│   ├── Lecture2.ppt
│   ├── Lecture3_Layering_AppLayerOverview.ppt
│   ├── Lecture4_5_Web.ppt
│   ├── Lecture6_DNS_CDN.ppt
│   ├── Lecture7_SMTP_P2P_SPAM.ppt
│   ├── Lecture8-Sockets_TransportIntro.ppt
│   └── Lecture9-UDP_RelXmit.ppt
├── Project1Files.zip
├── Project1Instructions.pdf
└── Syllabus.pdf

生成api令牌

  1. 导航到/profile/settings
  2. 在“批准的集成”部分下,单击按钮以生成新的访问令牌。
  3. 一旦生成了令牌,就不能再查看它,因此如果丢失了,就必须生成新的令牌。

macos上的gnu readline

要检查当前python正在使用的行编辑器库,请检查

echo "import readline\nprint(readline.__doc__)" | python

您应该会看到以下消息之一。

Importing this module enables command line editing using GNU readline.
Importing this module enables command line editing using libedit readline.

如果你看到第一条信息,你就可以走了!

如果您看到后者,最简单的解决方案是安装并配置Anaconda,这是一个包管理器,它提供了一个python发行版,并将GNU readline设置为命令行编辑器。

安装Anaconda

$ brew cask install anaconda

通过修改~/.bash_profile~/.zshrc文件,将anaconda二进制文件添加到您的路径中

# At some point after your PATH is defined...
export PATH=/usr/local/anaconda3/bin:"$PATH"

使用source ~/.zshrc或等效文件(或重新启动终端)保存编辑过的rc文件,然后将其作为源文件。

现在可以使用Anaconda的命令了!

创建新的虚拟环境

$ conda create --name py36 python=3.6

现在,在rc文件的export PATH=/usr/local/anaconda3/bin:"$PATH"行后面的某个位置,添加以下行:

source activate py36

保存rc文件,然后再次source ~/.zshrc或等效文件。

检查您的python版本,您应该在名称中看到Anaconda, Inc.

$ python --version
Python 3.6.4 :: Anaconda, Inc.

现在检查是否正在使用GNU readline

$ echo "import readline\nprint(readline.__doc__)" | python
Importing this module enables command line editing using GNU readline.

恭喜,您已经安装并使用GNU readline设置了一个python发行版!

pip install clanvas庆祝。

贡献

欢迎拉取请求!查看contributing页了解详细信息 关于如何帮助。

使用

构建

这些项目非常直接地使用,并且都欢迎拉取请求。如果你想添加一个未覆盖的 画布端点,或更改shell本身的行为,请查看以下项目:

许可证

这个项目是由麻省理工学院授权的。有关详细信息,请参见LICENSE文件。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java根据选择随机设置图标   java如何将Android Studio与本地服务器数据库SQL server 2008连接?   java在点击鼠标后绘制一个椭圆形   java选项窗格相对于其父项的位置   java如何在Android中的switch case中使用String[]输入?   安卓无法从“15.0.1”确定java版本   如果满足特定条件,java是否重置计时器?   java是一个实体类,可以在OOAD中返回其他实体实例吗?   bash将对jar文件| cut | awk和java程序的调用集成到一个统一进程中   Spring安全更新身份验证成功时的最后登录日期   数据库身份验证中基于Java控制台的客户端服务器登录应用程序错误   java Selenium junit测试失败,驱动程序过早获取URL   java LibGdx多点触摸事件混淆   带扫描仪的java打印空间   来自旧版应用程序的java springcloudsleuth头   java如何实现模板设计模式?   java如何比较具有多个值的键的两个映射?   读取时R中的java MemoryError。xlsx