Metadata-Version: 2.4
Name: canvasrobot
Version: 0.9.2
Summary: Library which uses Canvasapi (see https://canvasapi.readthedocs.io) to provide a CanvasRobot class.
Author-email: Nico de Groot <ndegroot0@gmail.com>
Requires-Python: <4.0.0,>=3.9
Requires-Dist: arrow<2.0.0,>=1.3.0
Requires-Dist: attrs>=24.2.0
Requires-Dist: bs4>=0.0.2
Requires-Dist: canvasapi>=3.3.0
Requires-Dist: cattrs>=24.1.3
Requires-Dist: ftfy>=6.3.1
Requires-Dist: keyring>=25.5.0
Requires-Dist: lxml>=5.3.0
Requires-Dist: mock>=5.1.0
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: pydal>=20241204.1
Requires-Dist: pymemcache>=4.0.0
Requires-Dist: pytest-mock>=3.14.0
Requires-Dist: pytz<2025.0,>=2024.2
Requires-Dist: pywebview==6.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: requests>=2.25.1
Requires-Dist: result>=0.17.0
Requires-Dist: rich-click>=1.8.4
Requires-Dist: rich>=13.9.4
Requires-Dist: scrapy>=2.12.0
Description-Content-Type: text/markdown

# CanvasRobot
Library which uses
[Canvasapi](https://canvasapi.readthedocs.io/en/stable/getting-started.html)
(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](https://docs.astral.sh/uv/getting-started/installation/)
Tip: use `brew` to install on macOS and `winget` on Windows. Check if the 
path is correct, after reopening terminal/Powershell

``` commandline
uv tool install canvasrobot

canvasrobot --help
urltransform --help
```

## Uses 
- [CanvasAPI](https://canvasapi.readthedocs.io/en/stable/getting-started.html) 
- 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
```Python
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](https://badge.fury.io/py/canvasrobot.svg)]
