Giter Club home page Giter Club logo

qcs-api-client-python's Introduction

Documentation Status

QCS API Client

A client library for accessing the Rigetti QCS API.

Usage

Synchronous Usage

from qcs_api_client.client import build_sync_client
from qcs_api_client.models import ListReservationsResponse
from qcs_api_client.operations.sync import list_reservations

with build_sync_client() as client:
    response: ListReservationsResponse = list_reservations(client=client).parsed

Asynchronous Usage

from qcs_api_client.client import build_async_client
from qcs_api_client.models import ListReservationsResponse
from qcs_api_client.operations.asyncio import list_reservations

# Within an event loop:
async with build_async_client() as client:
    response: ListReservationsResponse = await list_reservations(client=client).parsed

Configuration

By default, initializing your client with build_sync_client or build_async_client will use QCSClientConfiguation.load to load default configuration values. This function accepts:

  • A profile name (env: QCS_PROFILE_NAME). The name of the profile referenced in your settings file. If not provided, QCSClientConfiguation.load will evaluate this to a default_profile_name set in your settings file or "default".
  • A settings file path (env: QCS_SETTINGS_FILE_PATH). A path to the current user's settings file in TOML format. If not provided, QCSClientConfiguation.load will evaluate this to ~/.qcs/settings.toml.
  • A secrets file path (env: QCS_SECRETS_FILE_PATH). A path to the current user's secrets file in TOML format. If not provided, QCSClientConfiguation.load will evaluate this to ~/.qcs/secrets.toml. The user should have write access to this file, as the client will attempt to update the file with refreshed access tokens as necessary.

If you need to specify a custom profile name or path you can initialize your client accordingly:

from qcs_api_client.client import build_sync_client, QCSClientConfiguration
from qcs_api_client.models import ListReservationsResponse
from qcs_api_client.operations.sync import list_reservations

configuration = QCSClientConfiguration.load(
    profile_name='custom',
    secrets_file_path='./path/to/custom/secrets.toml',
    settings_file_path='./path/to/custom/settings.toml',
)

with build_sync_client(configuration=configuration) as client:
    response: ListReservationsResponse = list_reservations(client=client).parsed

Development

The source code for this repository is synchronized from another source. No commits made directly to GitHub will be retained.

qcs-api-client-python's People

Contributors

dbanty avatar semantic-release-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.