Update api.py

fixed gradebook view (added check for NoneType)