250 lines
10 KiB
Plaintext
250 lines
10 KiB
Plaintext
---
|
||
title: IBMQFactory
|
||
description: API reference for qiskit.providers.ibmq.IBMQFactory
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.providers.ibmq.IBMQFactory
|
||
---
|
||
|
||
# IBMQFactory
|
||
|
||
<Class id="qiskit.providers.ibmq.IBMQFactory" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-ibmq-provider/tree/stable/0.16/qiskit/providers/ibmq/ibmqfactory.py" signature="IBMQFactory" modifiers="class">
|
||
Bases: `object`
|
||
|
||
Factory and account manager for IBM Quantum Experience.
|
||
|
||
IBMQFactory constructor.
|
||
|
||
## Methods
|
||
|
||
### active\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.active_account" signature="IBMQFactory.active_account()">
|
||
Return the IBM Quantum Experience account currently in use for the session.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`Dict`\[`str`, `str`]]
|
||
|
||
**Returns**
|
||
|
||
Information about the account currently in the session.
|
||
</Function>
|
||
|
||
### delete\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.delete_account" signature="IBMQFactory.delete_account()" modifiers="static">
|
||
Delete the saved account from disk.
|
||
|
||
**Raises**
|
||
|
||
* [**IBMQAccountCredentialsNotFound**](qiskit.providers.ibmq.IBMQAccountCredentialsNotFound "qiskit.providers.ibmq.IBMQAccountCredentialsNotFound") – If no valid IBM Quantum Experience credentials can be found on disk.
|
||
* [**IBMQAccountMultipleCredentialsFound**](qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound "qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound") – If multiple IBM Quantum Experience credentials are found on disk.
|
||
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") – If invalid IBM Quantum Experience credentials are found on disk.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
|
||
### disable\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.disable_account" signature="IBMQFactory.disable_account()">
|
||
Disable the account currently in use for the session.
|
||
|
||
**Raises**
|
||
|
||
[**IBMQAccountCredentialsNotFound**](qiskit.providers.ibmq.IBMQAccountCredentialsNotFound "qiskit.providers.ibmq.IBMQAccountCredentialsNotFound") – If no account is in use for the session.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
|
||
### enable\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.enable_account" signature="IBMQFactory.enable_account(token, url='https://auth.quantum-computing.ibm.com/api', hub=None, group=None, project=None, **kwargs)">
|
||
Authenticate against IBM Quantum Experience for use during the session.
|
||
|
||
<Admonition title="Note" type="note">
|
||
With version 0.4 of this `qiskit-ibmq-provider` package, use of the legacy Quantum Experience and Qconsole (also known as the IBM Quantum Experience v1) credentials is no longer supported.
|
||
</Admonition>
|
||
|
||
**Parameters**
|
||
|
||
* **token** (`str`) – IBM Quantum Experience token.
|
||
|
||
* **url** (`str`) – URL for the IBM Quantum Experience authentication server.
|
||
|
||
* **hub** (`Optional`\[`str`]) – Name of the hub to use.
|
||
|
||
* **group** (`Optional`\[`str`]) – Name of the group to use.
|
||
|
||
* **project** (`Optional`\[`str`]) – Name of the project to use.
|
||
|
||
* **\*\*kwargs** –
|
||
|
||
Additional settings for the connection:
|
||
|
||
* proxies (dict): proxy configuration.
|
||
* verify (bool): verify the server’s TLS certificate.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`AccountProvider`]
|
||
|
||
**Returns**
|
||
|
||
If hub, group, and project are specified, the corresponding provider is returned. Otherwise the provider for the open access project is returned.
|
||
|
||
**Raises**
|
||
|
||
* [**IBMQAccountError**](qiskit.providers.ibmq.IBMQAccountError "qiskit.providers.ibmq.IBMQAccountError") – If an IBM Quantum Experience account is already in use for the session.
|
||
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") – If the URL specified is not a valid IBM Quantum Experience authentication URL.
|
||
* [**IBMQProviderError**](qiskit.providers.ibmq.IBMQProviderError "qiskit.providers.ibmq.IBMQProviderError") – If no provider matches the specified criteria, or more than one provider matches the specified criteria.
|
||
</Function>
|
||
|
||
### get\_provider
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.get_provider" signature="IBMQFactory.get_provider(hub=None, group=None, project=None)">
|
||
Return a provider for a single hub/group/project combination.
|
||
|
||
**Parameters**
|
||
|
||
* **hub** (`Optional`\[`str`]) – Name of the hub.
|
||
* **group** (`Optional`\[`str`]) – Name of the group.
|
||
* **project** (`Optional`\[`str`]) – Name of the project.
|
||
|
||
**Return type**
|
||
|
||
`AccountProvider`
|
||
|
||
**Returns**
|
||
|
||
A provider that matches the specified criteria.
|
||
|
||
**Raises**
|
||
|
||
[**IBMQProviderError**](qiskit.providers.ibmq.IBMQProviderError "qiskit.providers.ibmq.IBMQProviderError") – If no provider matches the specified criteria, or more than one provider matches the specified criteria.
|
||
</Function>
|
||
|
||
### load\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.load_account" signature="IBMQFactory.load_account()">
|
||
Authenticate against IBM Quantum Experience from stored credentials.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`AccountProvider`]
|
||
|
||
**Returns**
|
||
|
||
If the configuration file specifies a default provider, it is returned. Otherwise the provider for the open access project is returned.
|
||
|
||
**Raises**
|
||
|
||
* [**IBMQAccountCredentialsInvalidFormat**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidFormat "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidFormat") – If the default provider stored on disk could not be parsed.
|
||
* [**IBMQAccountCredentialsNotFound**](qiskit.providers.ibmq.IBMQAccountCredentialsNotFound "qiskit.providers.ibmq.IBMQAccountCredentialsNotFound") – If no IBM Quantum Experience credentials can be found.
|
||
* [**IBMQAccountMultipleCredentialsFound**](qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound "qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound") – If multiple IBM Quantum Experience credentials are found.
|
||
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") – If invalid IBM Quantum Experience credentials are found.
|
||
* [**IBMQProviderError**](qiskit.providers.ibmq.IBMQProviderError "qiskit.providers.ibmq.IBMQProviderError") – If the default provider stored on disk could not be found.
|
||
</Function>
|
||
|
||
### providers
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.providers" signature="IBMQFactory.providers(hub=None, group=None, project=None)">
|
||
Return a list of providers, subject to optional filtering.
|
||
|
||
**Parameters**
|
||
|
||
* **hub** (`Optional`\[`str`]) – Name of the hub.
|
||
* **group** (`Optional`\[`str`]) – Name of the group.
|
||
* **project** (`Optional`\[`str`]) – Name of the project.
|
||
|
||
**Return type**
|
||
|
||
`List`\[`AccountProvider`]
|
||
|
||
**Returns**
|
||
|
||
A list of providers that match the specified criteria.
|
||
</Function>
|
||
|
||
### save\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.save_account" signature="IBMQFactory.save_account(token, url='https://auth.quantum-computing.ibm.com/api', hub=None, group=None, project=None, overwrite=False, **kwargs)" modifiers="static">
|
||
Save the account to disk for future use.
|
||
|
||
<Admonition title="Note" type="note">
|
||
If storing a default provider to disk, all three parameters hub, group, project must be specified.
|
||
</Admonition>
|
||
|
||
**Parameters**
|
||
|
||
* **token** (`str`) – IBM Quantum Experience token.
|
||
|
||
* **url** (`str`) – URL for the IBM Quantum Experience authentication server.
|
||
|
||
* **hub** (`Optional`\[`str`]) – Name of the hub for the default provider to store on disk.
|
||
|
||
* **group** (`Optional`\[`str`]) – Name of the group for the default provider to store on disk.
|
||
|
||
* **project** (`Optional`\[`str`]) – Name of the project for the default provider to store on disk.
|
||
|
||
* **overwrite** (`bool`) – Overwrite existing credentials.
|
||
|
||
* **\*\*kwargs** –
|
||
|
||
* proxies (dict): Proxy configuration for the server.
|
||
* verify (bool): If False, ignores SSL certificates errors
|
||
|
||
**Raises**
|
||
|
||
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") – If the url is not a valid IBM Quantum Experience authentication URL.
|
||
* [**IBMQAccountCredentialsInvalidToken**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidToken "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidToken") – If the token is not a valid IBM Quantum Experience token.
|
||
* **IBMQAccountValueError** – If only one or two parameters from hub, group, project are specified.
|
||
|
||
**Return type**
|
||
|
||
`None`
|
||
</Function>
|
||
|
||
### stored\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.stored_account" signature="IBMQFactory.stored_account()" modifiers="static">
|
||
List the account stored on disk.
|
||
|
||
**Return type**
|
||
|
||
`Dict`\[`str`, `str`]
|
||
|
||
**Returns**
|
||
|
||
A dictionary with information about the account stored on disk.
|
||
|
||
**Raises**
|
||
|
||
* [**IBMQAccountMultipleCredentialsFound**](qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound "qiskit.providers.ibmq.IBMQAccountMultipleCredentialsFound") – If multiple IBM Quantum Experience credentials are found on disk.
|
||
* [**IBMQAccountCredentialsInvalidUrl**](qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl "qiskit.providers.ibmq.IBMQAccountCredentialsInvalidUrl") – If invalid IBM Quantum Experience credentials are found on disk.
|
||
</Function>
|
||
|
||
### update\_account
|
||
|
||
<Function id="qiskit.providers.ibmq.IBMQFactory.update_account" signature="IBMQFactory.update_account(force=False)" modifiers="static">
|
||
Interactive helper for migrating stored credentials to IBM Quantum Experience v2.
|
||
|
||
**Parameters**
|
||
|
||
**force** (`bool`) – If `True`, disable interactive prompts and perform the changes.
|
||
|
||
**Return type**
|
||
|
||
`Optional`\[`Credentials`]
|
||
|
||
**Returns**
|
||
|
||
The credentials for IBM Quantum Experience v2 if updating is successful or `None` otherwise.
|
||
</Function>
|
||
</Class>
|
||
|