Rails Api Error Handling In Python