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.
Describe the bug
File objects get attribute
content-typewhich must be accessed throughgetattr. All other attributes can be accessed bysome_file.attribute, but due to the-that doesn't work for thecontent-typeattribute.To Reproduce
Steps to reproduce the behavior:
Get an attachment from a submission (
submission.attachments). Then one must usegetattr(attachment, "content-type")to get the content type. But one can accessattachment.filenameby dot notation.Expected behavior
I would expect the
content-typeattribute to be translated tocontent_type.Environment information
python --version): Python 3.10.12pip show canvasapi):Additional context
Probably adding a translation of
-to_inCanvasObject.set_attributesshould suffice. Not sure if this would break anything.