From 9080c79a4e8c97b8c44d2013c189f5b8d69abe31 Mon Sep 17 00:00:00 2001 From: Guillaume Troupel Date: Fri, 27 Sep 2019 15:02:36 +0200 Subject: [PATCH] return user id on user creation --- keycloak/keycloak_admin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/keycloak/keycloak_admin.py b/keycloak/keycloak_admin.py index 9fdc040..5e4e5ef 100644 --- a/keycloak/keycloak_admin.py +++ b/keycloak/keycloak_admin.py @@ -235,7 +235,9 @@ class KeycloakAdmin: data_raw = self.connection.raw_post(URL_ADMIN_USERS.format(**params_path), data=json.dumps(payload)) - return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201) + raise_error_from_response(data_raw, KeycloakGetError, expected_code=201) + _last_slash_idx = data_raw.headers['Location'].rindex('/') + return data_raw.headers['Location'][_last_slash_idx + 1:] def users_count(self): """