{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "py_canvas_api\n#############\n\nThe idea is to have a simple, easy to understand library for the Canvas API.\n\nThe Canvas API (https://canvas.instructure.com/doc/api/index.html) has hundreds of endpoints.\n\nIt seemed pointless to me to write a unique method for every one of them.\nInstead, I created a class, called `ResterAPI` that uses `__getattr__` to\ndynamically generate the path for an endpoint and `__call__` to add a path\nelement with a parameter. The `Canvas` class is built on top of `ResterAPI`.\n\nThe result is a fairly small library that can handle the vast majority of\nCanvas API endpoints. \n\n\nInstantiate the Canvas object like this.\n\n.. code-block:: py\n\n from canvas_api import Canvas\n c = Canvas('somedomain.instructure.com', CANVAS_ACCESS_TOKEN=os.getenv('ACCESS_TOKEN'))\n\n\nBuilding paths\n==============\nYou build the path appending \"methods\" after the instanted canvas_api object.\n\nYou will typically see a line like `GET /api/v1/accounts/:account_id/courses`\nin the Canvas API documentation. This tells you what the path is and the inline\nparameters it needs. You would build this path with the `py_canvas_api` library\nlike this: `c.accounts(8423).courses`. Don't worry about the `/api/v1` part.\n\nThe `py_canvas_api` library takes care of the path parameters like :user by taking\nthem as method arguments. For example, here is how you would get courses in the\naccount with the id of 10 using the path above.\n\n.. code-block:: py\n\n # get a list of courses (paginated to 10) in the account\n accounts = c.accounts('self').courses.get().json()\n\nCommon Requests\n================\n\nGET\n-----\n\nTo make a `GET` request, simply end with `get()`. This tells the library to\nmake a GET request. This library uses the awesome `Requests`_ library so the\nreturn object in this case is simple a Response object. You will most often\nwant the response as a json object. You get this by calling .json() with the\nResponse.\n\n.. code-block:: py\n\n # get a list of courses (paginated to 10) in the account\n accounts_json = c.accounts('self').courses.get().json()\n\nIf you need to send query parameters (key-value pairs added after a question\nmark), add these as keyword parameters in the `get()` call. Let's say you want\na list of your own courses where you are a teacher and the enrollment is active. You would normally need to\nadd `?enrollment_type=teacher&enrollment_state=active` to the URL to do this. With the `py_canvas_api`\nlibrary, however, you would do it like this.\n\n.. code-block:: py\n\n # get a list of courses (paginated to 10) in the account\n accounts_json = c.courses.get(enrollment_type='teacher', enrollment_state='active').json()\n\nHere are several more `GET` examples.\n\n.. code-block:: py\n\n # list of users\n users = c.accounts('self').users.get().json()\n\n # assignments in course with canvas id 23423\n assignments = c.courses(23423).assignments.get().json()\n\n # assignments in course with sis id ENG101\n assignments = c.courses('sis_course_id:ENG101').assignments.get().json()\n\n # list communication channels for user with id 82\n channels = c.users(82).communication_channels.get().json()\n\n # list own communication channels\n channels = c.users('self').communication_channels.get().json()\n\n # Get a list of all courses in the account. This will keep pulling results as\n # long as there are more pages. It uses generator functions to do this is a\n # smart way.\n accounts = c.accounts('self').course.get_paginated()\n\nSpecial Cases\n==============\nThere are a few unique cases that are addressed in special\nclasses. For example, the `SIS Import API`_ takes a file upload and needs\nspecial handling.\n\nHere is how to do an SIS Import.\n\n.. code-block:: py\n\n from canvas_api import SISImporter\n sis_importer = SISImporter('somedomain.instructure.com', CANVAS_ACCESS_TOKEN=os.getenv('ACCESS_TOKEN'))\n sis_importer.do_sis_import(filepath)\n\n\n.. _`SIS Import API`: https://canvas.instructure.com/doc/api/sis_imports.html\n\n.. _`Requests`: http://docs.python-requests.org/en/master/\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kajigga/py_canvas_api", "keywords": "canvaslms", "license": "", "maintainer": "", "maintainer_email": "", "name": "py_canvas_api", "package_url": "https://pypi.org/project/py_canvas_api/", "platform": "", "project_url": "https://pypi.org/project/py_canvas_api/", "project_urls": { "Homepage": "https://github.com/kajigga/py_canvas_api" }, "release_url": "https://pypi.org/project/py_canvas_api/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "A very small library for accessing the API for the Canvas LMS.", "version": "0.2.2" }, "last_serial": 3888775, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b343991c34f1d0718cd085d9580805ba", "sha256": "16c96a7e91f7691436558ac6631da68bbcb26f628a2b80afa1563ae445562c08" }, "downloads": -1, "filename": "py_canvas_api-0.1.tar.gz", "has_sig": false, "md5_digest": "b343991c34f1d0718cd085d9580805ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3725, "upload_time": "2017-02-27T18:15:25", "url": "https://files.pythonhosted.org/packages/ca/1a/ee5f8025a2753854ef14e6ed195ceb6b3b4d4013d11361c1c597e4ca06bc/py_canvas_api-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "53ae6a3576749232a23c9137f486a732", "sha256": "aed613782b259491c1fe065fe358c250d744b109ba6c7fbb068b0b4ef6a18bf9" }, "downloads": -1, "filename": "py_canvas_api-0.1.1.tar.gz", "has_sig": false, "md5_digest": "53ae6a3576749232a23c9137f486a732", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4244, "upload_time": "2017-02-28T16:58:06", "url": "https://files.pythonhosted.org/packages/2d/34/5dcc0de708bb4fc89c3a4609a8c231ddde8fc3a4dcdf192fca75a279b1f6/py_canvas_api-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b2edd448081480e7a639334490fce35a", "sha256": "38207ccf5812c8c84b26d54b59ce3401a7733f712247e93d5fa2b6f42b3313ae" }, "downloads": -1, "filename": "py_canvas_api-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b2edd448081480e7a639334490fce35a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4235, "upload_time": "2017-04-14T00:09:23", "url": "https://files.pythonhosted.org/packages/bb/95/10c8f54637467f4663ce613d57b7a9a6e23a82c07baeb31fe70ac73cbbf5/py_canvas_api-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "7ce0bc0336c4a1efa9cb7d1993ded8d8", "sha256": "a7a499289b8eec5ab49500ce96d67c64ee340ac9871da4a08b2dacef37c365bc" }, "downloads": -1, "filename": "py_canvas_api-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7ce0bc0336c4a1efa9cb7d1993ded8d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4237, "upload_time": "2017-04-14T00:54:40", "url": "https://files.pythonhosted.org/packages/3d/9f/a55266af2fea186aaebebedda52e2d75fc3c02c3745291ab44927e055b38/py_canvas_api-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "9fc26b783948f73e7610d118f18cf390", "sha256": "abb431416e3f5de57843837fa09540e892e06634799212fe13a1c50941d970f5" }, "downloads": -1, "filename": "py_canvas_api-0.1.4.tar.gz", "has_sig": false, "md5_digest": "9fc26b783948f73e7610d118f18cf390", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4425, "upload_time": "2017-07-17T17:18:41", "url": "https://files.pythonhosted.org/packages/5b/40/203e392e013ba50bad2dddbf9d525a8e7b99cdc3b762203c4f75777763dd/py_canvas_api-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "2514658c581349063ac16859951e4d1f", "sha256": "dc0009b2ed4e11c133c76a7698d53c6dffa8435f67f652512bbca3ded8d2bb18" }, "downloads": -1, "filename": "py_canvas_api-0.1.5.tar.gz", "has_sig": false, "md5_digest": "2514658c581349063ac16859951e4d1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6037, "upload_time": "2018-01-10T14:52:22", "url": "https://files.pythonhosted.org/packages/22/38/7cc68c4157dababbfd9e04ed48fecd7c1eb8bab8c27c00e34e2388cc9ee5/py_canvas_api-0.1.5.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "4958601350bb161ede7a9e7b71c1f171", "sha256": "44ba7d1fd87efae7e48c9a16be3ad06aaade5d3a221caff11679a24a1f334feb" }, "downloads": -1, "filename": "py_canvas_api-0.2.0.tar.gz", "has_sig": false, "md5_digest": "4958601350bb161ede7a9e7b71c1f171", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3119, "upload_time": "2018-01-10T17:11:53", "url": "https://files.pythonhosted.org/packages/3e/e4/89bfa6490f1b062bb49394e9e4268cf8540ea4b1e79eb2c1e02218864b03/py_canvas_api-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5924dacbd35c35ecfc63a8280172dcc9", "sha256": "339f21f8faf49a3455beb393b84999cc05e425aec7b3b853d20c8c8eeadf3ff9" }, "downloads": -1, "filename": "py_canvas_api-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5924dacbd35c35ecfc63a8280172dcc9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7322, "upload_time": "2018-05-22T18:38:59", "url": "https://files.pythonhosted.org/packages/d3/c3/571ca6fb68d76c1b21bb20d5a097c0bc5f25a8b9a1f4975f9b92a6575a43/py_canvas_api-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "70afbdce5a6a5e8433e3231d11ba9708", "sha256": "e48d4f623df168aa36b1fa149024dcbbfad61e4fd7068ddd54f98d4150bb540c" }, "downloads": -1, "filename": "py_canvas_api-0.2.2.tar.gz", "has_sig": false, "md5_digest": "70afbdce5a6a5e8433e3231d11ba9708", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7323, "upload_time": "2018-05-22T18:44:07", "url": "https://files.pythonhosted.org/packages/88/4e/b0787910e00c1177ac36c5663855df438de7626f376bbde5805bd59b046f/py_canvas_api-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70afbdce5a6a5e8433e3231d11ba9708", "sha256": "e48d4f623df168aa36b1fa149024dcbbfad61e4fd7068ddd54f98d4150bb540c" }, "downloads": -1, "filename": "py_canvas_api-0.2.2.tar.gz", "has_sig": false, "md5_digest": "70afbdce5a6a5e8433e3231d11ba9708", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7323, "upload_time": "2018-05-22T18:44:07", "url": "https://files.pythonhosted.org/packages/88/4e/b0787910e00c1177ac36c5663855df438de7626f376bbde5805bd59b046f/py_canvas_api-0.2.2.tar.gz" } ] }