Open madsobitsoe opened 2 years ago
I see the potential value, but the rest of the library only accepts **kwargs
on routes that also accept arguments. The file upload flow doesn't accept any parameters, so adding that seems like it would be stepping outside the patterns used everywhere else.
When a file is uploaded successfully, it returns the attachment data that has to be posted to the submission endpoint anyways. The comment goes on the submission, not on the file.
I might be misreading/misunderstanding the code, but bear with me.
In this line of Submission.upload_comment
:
https://github.com/ucfopen/canvasapi/blob/285982043e714a90176a580a11dc0a40b0b1e382/canvasapi/submission.py#L180
Submission.edit
is called.
If I understand it correctly, this will create a new comment on the submission, with the attached file.
Can/Should I then use the returned response-object to obtain a reference to the posted submission comment, so I can edit the parameters of the comment after it has been posted?
(for example for setting the [group_comment]
parameter on the comment, when uploading files as feedback when grading).
When using
canvasapi.submission.Submission.upload_file
, the file is first uploaded, then attached to a comment withcanvasapi.submission.Submission.edit
.Is it possible to extend
upload_file
such that it accepts an optional**kwargs
, that can be passed toedit
in case the upload succeeded?This would allow for uploading a file setting the
text_comment
parameter for uploaded files, as well as setting thegroup_comment
parameter when uploading files as comments on a submission as a grader.