Skip to main content

Library which uses Canvasapi (see https://canvasapi.readthedocs.io) to provide a CanvasRobot class.

Project description

CanvasRobot

Library which uses Canvasapi (minimally patched to allow more flexible user search) to provide a CanvasRobot class for GUI and commandline use. You can install canvasrobot and urltransform (special edition to translate video urls in Canvas pages) using UV Tip: use brew to install on macOS and winget on Windows. Check if the path is correct, after reopening terminal/Powershell

uv tool install canvasrobot

canvasrobot --help
urltransform --help

Uses

  • CanvasAPI
  • rich
  • rich_click
  • keyring (safe store for API key)
  • pydal (to create a local SQLite database)
  • pywebview (HTML reporting)
  • [opt] pymemcache (install to add caching the Canvas interaction)

Used

In word2quiz library. (Not yet ready for general use...)

Examples

import rich
import canvasrobot as cr

if __name__ == '__main__':

    console = rich.console.Console(width=160, force_terminal=True)

    robot = cr.CanvasRobot(reset_api_keys=False,
                           console=console)

    # robot.update_database_from_canvas()
    robot.create_folder_in_all_courses('Tentamens')



    # result = robot.enroll_in_course("", 4472, 'u752058',
    # 'StudentEnrollment') #  (enrollment={'type': 'StudentEnrollment'}
    
    # user = robot.search_user('u752058')
    # print(user)
    # if not user:
    #   print(robot.errors)

    #COURSE_ID = 9999  # test course
    #result = robot.create_folder_in_course_files(COURSE_ID, 'Tentamens')

    # print(robot.course_metada(COURSE_ID))
    # print(robot.unpublish_folderitems_in_course(COURSE_ID,
    #                                            foldername,
    #                                            files_too=True))

    #course = robot.get_course(COURSE_ID)
    # tab = robot.get_course_tab_by_label(COURSE_ID, "Files")
    # print(tab.visibility)

    # for course_id in (COURSE_ID, COURSE_ID2):
    #     result = robot.create_folder_in_course_files(course_id, 'Tentamens')

    # result = robot.unpublish_subfolder_in_all_courses(foldername,
    #                                                  files_too=True,
    #                                                  check_only=True)
    # if course_ids_missing_folder:
    #    logging.info(f"Courses with missing folder {foldername}: {course_ids_missing_folder}")


    # QUIZZES -----------------------------

    # filename = 'Q_A.docx'
    # robot.create_quizzes_from_document(filename=filename,
    #                                    course_id=COURSE_ID,
    #                                    question_format='Vraag {}. Vertaal:',
    #                                    adjust_fontsize=True,
    #                                    testrun=False
    #                                    )

[PyPI version]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canvasrobot-0.9.2.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canvasrobot-0.9.2-py3-none-any.whl (3.0 MB view details)

Uploaded Python 3

File details

Details for the file canvasrobot-0.9.2.tar.gz.

File metadata

  • Download URL: canvasrobot-0.9.2.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for canvasrobot-0.9.2.tar.gz
Algorithm Hash digest
SHA256 76e9781e0916406899b2ee0a78f492d9f5226e5f47afc75cd6dd05a74497e093
MD5 f71f52b2454a2d49f6d6a6a67aea3e2e
BLAKE2b-256 419781ea41632c5a577b4bd77589bbbb27bd5be41568028d07a80b25130193f0

See more details on using hashes here.

File details

Details for the file canvasrobot-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: canvasrobot-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for canvasrobot-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98989a467bd4e7d87470736dc213890ca993cf3c118629a5e6d270914e6ff0b7
MD5 a5cb63706e865bd39f96cd4d71a40345
BLAKE2b-256 37ad26c412926f9a4a4f319f21cb58a353a024d1e8b3d3c9bd66544cb5dca1fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page