def get_list(self): query_url = urls.roles_url(self.database_url) response = self.session.get(query_url) if response.status_code == 200: return response.json() else: raise errors.UnexpectedResponseError( response.status_code, response.text )
def create(self, name, admin_channels=None): query_url = urls.roles_url(self.database_url) body = self._role_body(name, admin_channels) response = self.session.post(query_url, data=json.dumps(body)) if response.status_code == 201: return True elif response.status_code == 409: return False else: raise errors.UnexpectedResponseError( response.status_code, response.text )