-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"typed" API #580
Comments
A similar question was brought up in #601 because Canvas expects a list of dicts to update quiz questions. It's easy enough to solve - once you know what you're looking for. The Canvas API is so vast and subject to change that adding all of the attributes to the documentation would be a monumental task. I like the solution posed for #602, where arguments are automatically wrapped on endpoints which require a specific data structure. Maybe that could be an intermediate? |
It seems this package would be much easier to use if it supported "typed" access. Many parts of the Canvas API are only accessible via keyword arguments or passing dictionaries with special keys. For example, to set the
question_text
of a QuizQuestion requires doing this:which itself requires consulting the (non-Python) Canvas API to determine that
question_text
is a valid key to use in that dict. (And even then it's not without problems, e.g., #579).A better way would be if the canvasapi Python package supported this directly with a setter, e.g.,
which could then be documented (through docstrings on the setter method or property field) directly in the canvasapi Python package API docs at https://canvasapi.readthedocs.io/. It would also (huge win) allow auto-complete in IDEs to help make the API more easily "discoverable".
Is the only issue with this the time it would take to go through the (non-Python) Canvas API and look up all these attributes? Or the fear that it would become out of date if the Canvas API changes?
This isn't merely a matter of convenience; it's really not clear in some cases how to set these attributes, and the error messages when you do it wrong are also not very clear. (If you're lucky enough to get an error message; in some cases getting it wrong just means it silently fails.)
The text was updated successfully, but these errors were encountered: