updates endpoints.py: another exception syntax fix for Python 3