这是一个向canvas lms api发出请求的库。

canvas-api-client的Python项目详细描述


帆布帆布lms api-api客户端库
=
=


[综述]
[测试]
[测试]
[测试]
[文档]
[文档]
[安装]
[安装]
[使用]
[使用]
[贡献]
[贡献]
[参考文献]
[参考文献]
[参考文献]
[综述][综述]
[文档]
[文档]
[安装]
[安装]
[使用]
[使用]
[使用]
[贡献]
[贡献]
[贡献]
[贡献]
[贡献]
[/>
移动rview
----


这是一个向画布lms api发出请求的库。


测试
----


此项目使用[tox]进行测试(https://tox.readthedocs.io/en/latest/)。

最后,这个项目的tox运行:

*[flake8](http://flake8.pycqa.org/en/latest/)
*[mypy](http s://github.com/python/mypy)
*[pytest](https://docs.pytest.org/en/latest/)

创建测试覆盖率报告:
``````
$tox-e cov
````

/>
部署到PYPI使用tox:
```
$tox-e deploy
````
在部署之前,请确保在setup.py中提升版本。

documentation
----


此项目具有sphinx文档,网址如下:
https://lcary.github.io/canvas-lms-tools/

Public Canvas LMS API文档也非常有用:
https://canvas.instructure.com/doc/api/index.html

//github.com/lcary/canvas lms tools.git
cd canvas lms tools/canvas廑api廑client
python setup.py install

usage
----


/>
```
$python
>>gt;来自canvas_api_client.v1_client import canvasapiv1
>>gt;url='https://my.canvas.instance.com/api/v1/'
>>gt;token='1396~xxxxxxxxxxxx thisxisxnotxaxrealxtokenxxxxxxxxxxxxxxxx'
>>api=canvasapiv1(url,token)
>;>l=api.get_account_blueprint_courses('1234')
>;>l.json()中的r:
…print(r['id',r['name'])

49400课程蓝图
57600春季2018蓝图
`````

脚本示例

这个非常简单的示例需要几个环境变量。
api url和令牌应该类似于:
``
canvas-api-url=https://my.canvas.instance.com/api/v1/
canvas-api-token=1396~xxxxxxxxxxxxxxxx thisxisnotxaxrealxtokenxxxxxxxxxxxxxxxxx
``

rmission而不是环境变量,但请在这里忍受我。


一旦通过pip安装到您的项目中,请使用以下命令:

``python
from os import environ
from pprint import pprint

from canvas-api-client.v1\u client import canvasapiv1

url=environ.get('canvas_api_url')
token=environ.get('canvas_api_token')

params={"override_sis_粘性":"true"}
response=api.import_sis_data('1','./courses.csv',params=params)

print('sis import response:')
pprint(response.json())
`

canvasapiv1

"canvasapiv1"客户端
对象需要"api-url"参数和"api-token"参数。"api-url"
应该在配置文件中定义,并且应该是没有端点的完整api
url,例如"https://canvas.com/api/v1/"。类似地,"api_token"
应该在配置文件中定义,并且是在画布设置页中生成的令牌。


有几个助手函数可以帮助在"canvasapiv1"中的方法之间共享代码,值得指出。例如,对于每个请求类型都有一个
方法,例如`.u get()`f或者获取请求,等等。这些请求类型方法中的每一个都调用"self.\u send_request()",它接受
个参数并返回
[`requests.response`](http://docs.python requests.org/en/master/api/`requests.response)
对象。因此,api客户机的大多数公共方法都返回
一个"response"对象,因此调用方可以访问典型的response
方法,例如"response.json()"。

这不一定是推荐的;此功能只存在于
以便在单元测试中方便地进行依赖注入,以及与诸如请求oauthlib之类的库的兼容性


有关详细信息,请参阅客户端接口[文档](文档)。

贡献
----


构建轮子


安装--无索引--查找链接=dist canvas_api_client

或者,通过指定指向`.whl'文件的完整或相对路径来安装:

pip安装--无索引/路径/到/canvas lms tools/canvas_api_client/dist/canvas_api_client-<;version>;-py2.py3无任何.whl

(yo如果您是从另一个
项目安装,则可能需要先"pip install wheel"。请参阅[堆栈溢出](https://stack overflow.com/questions/28002897/wheel file installation)
以获取更多帮助。)


build/html/index.html


将文档部署到github页面:

git pull
git branch-d gh pages
git checkout-b gh pages
rm-rf./*
touch.nojekyll
git checkout master canvas_api_client/docs/
<;构建如上所述的文档>;
mv canvas_api_client/docs/build/html/*./
rm-rf canvas_api_client
git add-a
git commit
git push-f origin gh pages

有关更多信息,请参阅[github pages documentation](http s://pages.github.com/),
[sphinx docs](http://www.sphinx doc.org/en/master/contents.html)、
或以下[脚本文档](http://www.willmcginnis.com/2016/02/29/automating documentation workflow with sphinx and github pages/)。


https://github.com/wdm0006/cookiecutter-pipproject



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

推荐PyPI第三方库


热门话题
使用SerializationUtils时java ClassNotFoundException。克隆()   java Cucumber+spring:如何通过测试触发SmartLifecycle事件?   java如何使ProGuard以简单的方式工作?   java JSP页面显示来自集合的日期   谷歌地图检查坐标是否位于JAVA中谷歌地图API的多边形中   java如何在终端中使用“tokens”打印令牌?   java获取编译错误:包com。威里奥。sdk不存在   java会使用JAXB或类似工具自动填充HATEAOS链接吗?   Javascript(GraalJS)与Java中未签名的右移>>>>   如何在Java代码中创建jdbc请求的Jmeter测试   java如何在CellList中添加或删除单个元素?   java Progressbar:如何创建原始对象的深度副本