Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

IBMQFactory

class IBMQFactory

GitHub

Bases: object

Factory and account manager for IBM Quantum Experience.

IBMQFactory constructor.


Methods

active_account

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.

delete_account

static IBMQFactory.delete_account()

Delete the saved account from disk.

Raises

Return type

None

disable_account

IBMQFactory.disable_account()

Disable the account currently in use for the session.

Raises

IBMQAccountCredentialsNotFound – If no account is in use for the session.

Return type

None

enable_account

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.

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.

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 – If an IBM Quantum Experience account is already in use for the session.
  • IBMQAccountCredentialsInvalidUrl – If the URL specified is not a valid IBM Quantum Experience authentication URL.
  • IBMQProviderError – If no provider matches the specified criteria, or more than one provider matches the specified criteria.

get_provider

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 – If no provider matches the specified criteria, or more than one provider matches the specified criteria.

load_account

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

providers

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.

save_account

static IBMQFactory.save_account(token, url='https://auth.quantum-computing.ibm.com/api', hub=None, group=None, project=None, overwrite=False, **kwargs)

Save the account to disk for future use.

Note

If storing a default provider to disk, all three parameters hub, group, project must be specified.

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

Return type

None

stored_account

static IBMQFactory.stored_account()

List the account stored on disk.

Return type

Dict[str, str]

Returns

A dictionary with information about the account stored on disk.

Raises

update_account

static IBMQFactory.update_account(force=False)

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.

Was this page helpful?
Report a bug or request content on GitHub.