Commit 0a6081fa authored by Kiste's avatar Kiste
Browse files

Prepare downloading single files for new files API

parent cec32ad3
......@@ -41,14 +41,17 @@ def holordner(path, s, course, folder):
jfiles = s.get(BASEURL + '/documents/' + course['course_id'] + '/folder/' + folder['folder_id'])
for subfolder in jfiles.json()['folders']:
holordner(path, s, course,subfolder)
holordner(path, s, course, subfolder)
for file in jfiles.json()['documents']:
f = path + '/' + course['title'] + '/' + file['filename']
for document in jfiles.json()['documents']:
holdatei(path, s, course, document)
if not os.path.isfile(f):
fdl = s.get(BASEURL + '/documents/' + file['document_id'] + '/download', stream=True)
if fdl.status_code == 200:
with open(f, 'wb') as file:
fdl.raw.decode_content = True
shutil.copyfileobj(fdl.raw, file)
def holdatei(path, s, course, document):
target = path + '/' + course['title'] + '/' + document['filename']
download = s.get(BASEURL + '/documents/' + document['document_id'] + '/download', stream=True)
if download.status_code == 200:
with open(document, 'wb') as file:
download.raw.decode_content = True
shutil.copyfileobj(download.raw, file)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment