qiskit_quantuminspire.api package¶
Submodules¶
qiskit_quantuminspire.api.authentication module¶
- exception qiskit_quantuminspire.api.authentication.AuthorisationError[source]¶
Bases:
Exception
Indicates that the authorisation permanently went wrong.
- class qiskit_quantuminspire.api.authentication.IdentityProvider(well_known_endpoint: str)[source]¶
Bases:
object
Class for interfacing with the IdentityProvider.
- class qiskit_quantuminspire.api.authentication.OauthDeviceSession(host: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], settings: ~qiskit_quantuminspire.api.settings.ApiSettings, identity_provider: ~qiskit_quantuminspire.api.authentication.IdentityProvider)[source]¶
Bases:
object
Class for storing OAuth session information and refreshing tokens when needed.
qiskit_quantuminspire.api.client module¶
- class qiskit_quantuminspire.api.client.Configuration(host: str, oauth_session: OauthDeviceSession, **kwargs: Any)[source]¶
Bases:
Configuration
Original Configuration class in compute_api_client does not handle refreshing bearer tokens, so we need to add some functionality.
- qiskit_quantuminspire.api.client.config() Configuration [source]¶
qiskit_quantuminspire.api.pagination module¶
- class qiskit_quantuminspire.api.pagination.PageInterface(*, items: List[ItemType], total: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=0)])] | None, page: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])] | None, size: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])] | None, pages: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=0)])] | None = None)[source]¶
Bases:
BaseModel
,Generic
[ItemType
]The page models in the generated API client don’t inherit from a common base class, so we have to trick the typing system a bit with this fake base class.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- page: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])] | None¶
- pages: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=0)])] | None¶
- class qiskit_quantuminspire.api.pagination.PageReader[source]¶
Bases:
Generic
[PageType
,ItemType
]Helper class for reading fastapi-pagination style pages returned by the compute_api_client.
qiskit_quantuminspire.api.settings module¶
Module containing the handler for the Quantum Inspire persistent configuration.
- class qiskit_quantuminspire.api.settings.ApiSettings(*, auths: ~typing.Dict[~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], ~qiskit_quantuminspire.api.settings.AuthSettings], default_host: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)])[source]¶
Bases:
BaseModel
The settings class for the Quantum Inspire persistent configuration.
- auths: Dict[Url, AuthSettings]¶
- default_host: Url¶
- classmethod from_config_file(path: Path = PosixPath('/home/runner/.quantuminspire/config.json')) ApiSettings [source]¶
Load the configuration from a file.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- store_tokens(host: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], tokens: ~qiskit_quantuminspire.api.settings.TokenInfo, path: ~pathlib.Path = PosixPath('/home/runner/.quantuminspire/config.json')) None [source]¶
Stores the team_member_id, access and refresh tokens in the config.json file.
- Parameters:
host – The hostname of the API for which the tokens are intended.
tokens – OAuth access and refresh tokens.
path – The path to the config.json file. Defaults to API_SETTINGS_FILE.
- Returns:
None
- class qiskit_quantuminspire.api.settings.AuthSettings(*, client_id: str, code_challenge_method: str, code_verifyer_length: int, well_known_endpoint: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], tokens: ~qiskit_quantuminspire.api.settings.TokenInfo | None, team_member_id: int | None)[source]¶
Bases:
BaseModel
Pydantic model for storing all auth related settings for a given host.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- well_known_endpoint: Url¶
- class qiskit_quantuminspire.api.settings.TokenInfo(*, access_token: str, expires_in: int, refresh_token: str, refresh_expires_in: int | None = None, generated_at: float = <factory>)[source]¶
Bases:
BaseModel
A pydantic model for storing all information regarding oauth access and refresh tokens.
- property access_expires_at: float¶
Unix timestamp containing the time when the access token will expire.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].