[docs]classConfiguration(compute_api_client.Configuration):# type: ignore[misc]"""Original Configuration class in compute_api_client does not handle refreshing bearer tokens, so we need to add some functionality."""def__init__(self,host:str,oauth_session:OauthDeviceSession,**kwargs:Any):self._oauth_session=oauth_sessionsuper().__init__(host=host,**kwargs)
[docs]defconnect()->None:"""Set connection configuration for the Quantum Inspire API. Call after logging in with the CLI. Will remove old configuration. """global_configsettings=ApiSettings.from_config_file()tokens=settings.auths[settings.default_host].tokensiftokensisNone:raiseValueError("No access token found for the default host. Please connect to Quantum Inspire using the CLI.")host=settings.default_host_config=Configuration(host=host,oauth_session=OauthDeviceSession(host,settings,IdentityProvider(settings.auths[host].well_known_endpoint)),)