def delete(self): if self.id == 0: return False conn = APIConn() data = {} data = {'action': 'deletecontact', 'contactid': self.id} resp = conn.request(data) return True
def save(self): data = self.clean() conn = APIConn() if self.id == 0: data['action'] = 'addcontact' else: data['action'] = 'updatecontact' data['contactid'] = self.id resp = conn.request(data) self.id = int(resp['contactid'])
def send_call(self): # this function should handle all errors conn = APIConn() resp = conn.request(self.data) return resp