python-to-cosm: Handle HTTP error