Open
Description
Describe the bug
File objects get attribute content-type
which must be accessed through getattr
. All other attributes can be accessed by some_file.attribute
, but due to the -
that doesn't work for the content-type
attribute.
To Reproduce
Steps to reproduce the behavior:
Get an attachment from a submission (submission.attachments
). Then one must use getattr(attachment, "content-type")
to get the content type. But one can access attachment.filename
by dot notation.
Expected behavior
I would expect the content-type
attribute to be translated to content_type
.
Environment information
- Python version (
python --version
): Python 3.10.12 - CanvasAPI version (
pip show canvasapi
):
Name: canvasapi
Version: 3.2.0
Summary: API wrapper for the Canvas LMS
Home-page: https://github.com/ucfopen/canvasapi
Author: University of Central Florida - Center for Distributed Learning
Author-email: techrangers@ucf.edu
License: MIT License
Location: /home/dbosk/.cache/pypoetry/virtualenvs/canvaslms-WPDgHmeP-py3.10/lib/python3.10/site-packages
Requires: arrow, pytz, requests
Required-by: canvaslms
Additional context
Probably adding a translation of -
to _
in CanvasObject.set_attributes
should suffice. Not sure if this would break anything.