From f9eb6374563d04b61c497ee83d2443135ac2f144 Mon Sep 17 00:00:00 2001 From: Andreas Bleuler Date: Mon, 3 Jun 2019 16:27:46 +0200 Subject: [PATCH 1/2] Fix copy-pasted docstring --- keycloak/keycloak_admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keycloak/keycloak_admin.py b/keycloak/keycloak_admin.py index 9fdc040..429a93e 100644 --- a/keycloak/keycloak_admin.py +++ b/keycloak/keycloak_admin.py @@ -179,13 +179,13 @@ class KeycloakAdmin: def create_realm(self, payload, skip_exists=False): """ - Create a client + Create a realm ClientRepresentation: http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_realmrepresentation :param skip_exists: Skip if Realm already exist. :param payload: RealmRepresentation - :return: Keycloak server response (UserRepresentation) + :return: Keycloak server response (RealmRepresentation) """ data_raw = self.connection.raw_post(URL_ADMIN_REALMS, From 1c03f1a9943040ddf2ced0525b1b3d9bd8a1b476 Mon Sep 17 00:00:00 2001 From: Andreas Bleuler Date: Tue, 1 Oct 2019 18:01:53 +0200 Subject: [PATCH 2/2] Add update method for clients --- keycloak/keycloak_admin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/keycloak/keycloak_admin.py b/keycloak/keycloak_admin.py index 429a93e..5d57661 100644 --- a/keycloak/keycloak_admin.py +++ b/keycloak/keycloak_admin.py @@ -685,6 +685,20 @@ class KeycloakAdmin: data=json.dumps(payload)) return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201, skip_exists=skip_exists) + def update_client(self, client_id, payload): + """ + Update a client + + :param client_id: Client id + :param payload: ClientRepresentation + + :return: Http response + """ + params_path = {"realm-name": self.realm_name, "id": client_id} + data_raw = self.connection.raw_put(URL_ADMIN_CLIENT.format(**params_path), + data=json.dumps(payload)) + return raise_error_from_response(data_raw, KeycloakGetError, expected_code=204) + def delete_client(self, client_id): """ Get representation of the client