Added exception handling in api.py