move try / except to api request