Browse Source
Merge pull request #346 from fredlb/custom-timeout
feat: Ability to set custom timeout for KeycloakOpenId and KeycloakAdmin
pull/348/head
v1.8.0
Richard Nemeth
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
1 deletions
-
src/keycloak/keycloak_admin.py
-
src/keycloak/keycloak_openid.py
|
@ -88,6 +88,7 @@ class KeycloakAdmin: |
|
|
custom_headers=None, |
|
|
custom_headers=None, |
|
|
user_realm_name=None, |
|
|
user_realm_name=None, |
|
|
auto_refresh_token=None, |
|
|
auto_refresh_token=None, |
|
|
|
|
|
timeout=60, |
|
|
): |
|
|
): |
|
|
self.server_url = server_url |
|
|
self.server_url = server_url |
|
|
self.username = username |
|
|
self.username = username |
|
@ -100,6 +101,7 @@ class KeycloakAdmin: |
|
|
self.auto_refresh_token = auto_refresh_token or [] |
|
|
self.auto_refresh_token = auto_refresh_token or [] |
|
|
self.user_realm_name = user_realm_name |
|
|
self.user_realm_name = user_realm_name |
|
|
self.custom_headers = custom_headers |
|
|
self.custom_headers = custom_headers |
|
|
|
|
|
self.timeout = timeout |
|
|
|
|
|
|
|
|
# Get token Admin |
|
|
# Get token Admin |
|
|
self.get_token() |
|
|
self.get_token() |
|
@ -2695,6 +2697,7 @@ class KeycloakAdmin: |
|
|
verify=self.verify, |
|
|
verify=self.verify, |
|
|
client_secret_key=self.client_secret_key, |
|
|
client_secret_key=self.client_secret_key, |
|
|
custom_headers=self.custom_headers, |
|
|
custom_headers=self.custom_headers, |
|
|
|
|
|
timeout=self.timeout, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
grant_type = [] |
|
|
grant_type = [] |
|
|
|
@ -73,13 +73,14 @@ class KeycloakOpenID: |
|
|
verify=True, |
|
|
verify=True, |
|
|
custom_headers=None, |
|
|
custom_headers=None, |
|
|
proxies=None, |
|
|
proxies=None, |
|
|
|
|
|
timeout=60, |
|
|
): |
|
|
): |
|
|
self.client_id = client_id |
|
|
self.client_id = client_id |
|
|
self.client_secret_key = client_secret_key |
|
|
self.client_secret_key = client_secret_key |
|
|
self.realm_name = realm_name |
|
|
self.realm_name = realm_name |
|
|
headers = custom_headers if custom_headers is not None else dict() |
|
|
headers = custom_headers if custom_headers is not None else dict() |
|
|
self.connection = ConnectionManager( |
|
|
self.connection = ConnectionManager( |
|
|
base_url=server_url, headers=headers, timeout=60, verify=verify, proxies=proxies |
|
|
|
|
|
|
|
|
base_url=server_url, headers=headers, timeout=timeout, verify=verify, proxies=proxies |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
self.authorization = Authorization() |
|
|
self.authorization = Authorization() |
|
|