@ -88,7 +88,7 @@ class KeycloakAdmin:
def __init__ (
def __init__ (
self ,
self ,
server_url ,
server_url = None ,
username = None ,
username = None ,
password = None ,
password = None ,
token = None ,
token = None ,
@ -815,7 +815,7 @@ class KeycloakAdmin:
)
)
raise_error_from_response ( data_raw , KeycloakPostError , expected_codes = [ 201 ] )
raise_error_from_response ( data_raw , KeycloakPostError , expected_codes = [ 201 ] )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
def users_count ( self , query = None ) :
def users_count ( self , query = None ) :
""" Count users.
""" Count users.
@ -1339,7 +1339,7 @@ class KeycloakAdmin:
)
)
try :
try :
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
except KeyError :
except KeyError :
return
return
@ -1965,7 +1965,7 @@ class KeycloakAdmin:
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
)
)
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
def update_client ( self , client_id , payload ) :
def update_client ( self , client_id , payload ) :
""" Update a client.
""" Update a client.
@ -2218,7 +2218,7 @@ class KeycloakAdmin:
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
)
)
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
def add_composite_client_roles_to_role ( self , client_role_id , role_name , roles ) :
def add_composite_client_roles_to_role ( self , client_role_id , role_name , roles ) :
""" Add composite roles to client role.
""" Add composite roles to client role.
@ -2385,7 +2385,7 @@ class KeycloakAdmin:
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
)
)
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
def get_realm_role ( self , role_name ) :
def get_realm_role ( self , role_name ) :
""" Get realm role by role name.
""" Get realm role by role name.
@ -3281,7 +3281,7 @@ class KeycloakAdmin:
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
data_raw , KeycloakPostError , expected_codes = [ 201 ] , skip_exists = skip_exists
)
)
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
def update_client_scope ( self , client_scope_id , payload ) :
def update_client_scope ( self , client_scope_id , payload ) :
""" Update a client scope.
""" Update a client scope.
@ -3650,7 +3650,7 @@ class KeycloakAdmin:
)
)
raise_error_from_response ( data_raw , KeycloakPostError , expected_codes = [ 201 ] )
raise_error_from_response ( data_raw , KeycloakPostError , expected_codes = [ 201 ] )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
_last_slash_idx = data_raw . headers [ " Location " ] . rindex ( " / " )
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
return data_raw . headers [ " Location " ] [ _last_slash_idx + 1 : ] # noqa: E203
def get_component ( self , component_id ) :
def get_component ( self , component_id ) :
""" Get representation of the component.
""" Get representation of the component.