Skip to content

config

Classes:

  • OqtopusConfig

    A configuration information class for using OQTOPUS backend.

OqtopusConfig

OqtopusConfig(
    url: str, api_token: str, proxy: str | None = None
)

A configuration information class for using OQTOPUS backend.

Parameters:

  • url

    (str) –

    Base URL for OQTOPUS Cloud.

  • api_token

    (str) –

    API token for OQTOPUS Cloud.

Raises:

  • ValueError

    If url or api_token is None.

Methods:

  • from_file

    Read configuration information from a file.

Attributes:

  • api_token (str) –

    Return the API token.

  • proxy (str | None) –

    Return the proxy.

  • url (str) –

    Return the url.

api_token property

api_token: str

Return the API token.

Returns:

  • str ( str ) –

    the API token to access OCTOPUS Cloud.

proxy property

proxy: str | None

Return the proxy.

Returns:

  • str | None

    str | None: the proxy to access OCTOPUS Cloud.

url property

url: str

Return the url.

Returns:

  • str ( str ) –

    the url to access OCTOPUS Cloud.

from_file staticmethod

from_file(
    section: str | None = "default",
    path: str | None = "~/.oqtopus",
) -> OqtopusConfig

Read configuration information from a file.

Parameters:

  • section

    (str | None, default: 'default' ) –

    A :class:OqtopusConfig for circuit execution.

  • path

    (str | None, default: '~/.oqtopus' ) –

    A path for config file.

Returns:

  • OqtopusConfig

    Configuration information :class:OqtopusConfig .

Raises: ValueError: If path is None.

Examples:

The OQTOPUS configuration file describes configuration information for each section. A section has a header in the form [section]. The default file path is ~/.oqtopus and the default section name is default. Each section describes a setting in the format key=value. An example of a configuration file description is as below:

.. code-block::

[default]
url=<base URL>
api_token=<API token>

[sectionA]
url=<base URL>
api_token=<API token>

[sectioB]
url=<base URL>
api_token=<API token>
proxy=http://<proxy>:<port>

If sectionA settings are to be used, initialize OqtopusSamplingBackend as follows

.. code-block::

backend = OqtopusSamplingBackend(OqtopusConfig.from_file("sectionA"))