Skip to content

Commit d43b54a

Browse files
Merge pull request Peter-Slump#29 from ableuler/master
Add method to update clients
2 parents f8b35aa + 1c03f1a commit d43b54a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

keycloak/keycloak_admin.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ def get_realms(self):
179179

180180
def create_realm(self, payload, skip_exists=False):
181181
"""
182-
Create a client
182+
Create a realm
183183
184184
ClientRepresentation: http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_realmrepresentation
185185
186186
:param skip_exists: Skip if Realm already exist.
187187
:param payload: RealmRepresentation
188-
:return: Keycloak server response (UserRepresentation)
188+
:return: Keycloak server response (RealmRepresentation)
189189
"""
190190

191191
data_raw = self.connection.raw_post(URL_ADMIN_REALMS,
@@ -685,6 +685,20 @@ def create_client(self, payload, skip_exists=False):
685685
data=json.dumps(payload))
686686
return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201, skip_exists=skip_exists)
687687

688+
def update_client(self, client_id, payload):
689+
"""
690+
Update a client
691+
692+
:param client_id: Client id
693+
:param payload: ClientRepresentation
694+
695+
:return: Http response
696+
"""
697+
params_path = {"realm-name": self.realm_name, "id": client_id}
698+
data_raw = self.connection.raw_put(URL_ADMIN_CLIENT.format(**params_path),
699+
data=json.dumps(payload))
700+
return raise_error_from_response(data_raw, KeycloakGetError, expected_code=204)
701+
688702
def delete_client(self, client_id):
689703
"""
690704
Get representation of the client

0 commit comments

Comments
 (0)