Downloading calendar for each course
parent
9d75f662f5
commit
4ac75f5456
|
@ -10,6 +10,12 @@ See [`example.yaml`](example.yaml) and [`example-tokens.yaml`](example-tokens.ya
|
|||
The `tokens.yaml` file should be ignored by version control systems. If you are not familiar with YAML, you can stick to JSON.
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
`pip install unicodecsv requests`
|
||||
|
||||
If you want to build stand-alone binaries, also install PyInstaller: `pip install pyinstaller`
|
||||
|
||||
|
||||
Windows Binaries
|
||||
----------------
|
||||
|
|
|
@ -137,7 +137,7 @@ def load_all_courses(config, cms_connections):
|
|||
for course in courses:
|
||||
# Check if files already exist
|
||||
ident = course+'@'+system
|
||||
if os.path.isfile(join(out, ident+'.course.json')) and os.path.isfile(join(out, ident+'.csv')):
|
||||
if os.path.isfile(join(out, ident+'.calendar.json')) and os.path.isfile(join(out, ident+'.csv')):
|
||||
if os.path.getsize(join(out, ident+'.csv')) > 0:
|
||||
print 'Found:',ident
|
||||
tables[ident] = StudentTable.from_file(join(out, ident+'.csv'))
|
||||
|
@ -151,6 +151,15 @@ def load_all_courses(config, cms_connections):
|
|||
f.write(json.dumps(coursedata, indent=4))
|
||||
else:
|
||||
warn('Could not get course info for '+ident)
|
||||
|
||||
# Download calendar
|
||||
calendar_data = cms_connections[system].calendar_events_index(course=course)
|
||||
if calendar_data:
|
||||
with open(join(out, ident+'.calendar.json'), 'wb') as f:
|
||||
f.write(json.dumps(calendar_data, indent=4))
|
||||
else:
|
||||
warn('Could not get calendar for '+ident)
|
||||
|
||||
# Download student table
|
||||
tables[ident] = StudentTable.from_cms(cms_connections[system], course)
|
||||
tables[ident].save(join(out, ident+'.csv'))
|
||||
|
|
Loading…
Reference in New Issue