Print more info on attachments.

This commit is contained in:
Jason K. Moore 2020-07-08 14:20:35 -07:00
parent fa7e2f5046
commit b6f787167f
1 changed files with 3 additions and 1 deletions

View File

@ -258,10 +258,12 @@ def download_submission_attachments(course, course_view):
for attachment in submission.attachments: for attachment in submission.attachments:
filepath = os.path.join(attachment_dir, attachment.filename) filepath = os.path.join(attachment_dir, attachment.filename)
if not os.path.exists(filepath): if not os.path.exists(filepath):
print('Downloading attachment: {}'.format(attachment.filename)) print('Downloading attachment: {}'.format(filepath))
r = requests.get(attachment.url, allow_redirects=True) r = requests.get(attachment.url, allow_redirects=True)
with open(filepath, 'wb') as f: with open(filepath, 'wb') as f:
f.write(r.content) f.write(r.content)
else:
print('File already exists: {}'.format(filepath))
def getCoursePageUrls(course): def getCoursePageUrls(course):