My team is using this lib in a commercial project to connect Keycloak from Fastapi and we observed this lib doesn't use timeout in connection to Keycloak, to avoid that I wrote this:
class CustomTimeout(TimeoutSauce):
def __init__(self, *args, **kwargs):
if kwargs['connect'] is None:
kwargs['connect'] = 5
if kwargs['read'] is None:
kwargs['read'] = 5
super().__init__(*args, **kwargs)
requests.adapters.TimeoutSauce = CustomTimeout
IDP = FastAPIKeycloak(
server_url=KEYCLOAK_SERVER_URL,
client_id=KEYCLOAK_CLIENT_ID,
client_secret=KEYCLOAK_CLIENT_SECRET,
admin_client_secret=KEYCLOAK_ADMIN_CLIENT_SECRET,
realm=KEYCLOAK_REALM,
callback_uri=KEYCLOAK_CALLBACK_URI,
)
And decided to add timeout to FastAPIKeycloak init. Code checked and all tests passed
Please review my PR and approve if it is okay for you to see timeout in this lib
My team is using this lib in a commercial project to connect Keycloak from Fastapi and we observed this lib doesn't use timeout in connection to Keycloak, to avoid that I wrote this:
And decided to add timeout to FastAPIKeycloak init. Code checked and all tests passed
Please review my PR and approve if it is okay for you to see timeout in this lib