def __check_success ( resp ) : if "success" not in resp . keys ( ) : try : raise APIError ( '200' , 'Operation Failed' , resp [ "error" ] ) except KeyError : raise APIError ( '200' , 'Operation Failed' , str ( resp ) ) return resp [ "success" ]
python check success of response
Check a JSON server response to see if it was successful
def __check_success(resp):
        """ Check a JSON server response to see if it was successful

        :type resp: Dictionary (parsed JSON from response)
        :param resp: the response string

        :rtype: String
        :returns: the success message, if it exists

        :raises: APIError if the success message is not present


        """

        if "success" not in resp.keys():
            try:
                raise APIError('200', 'Operation Failed', resp["error"])
            except KeyError:
                raise APIError('200', 'Operation Failed', str(resp))
        return resp["success"]