Skip to main content

H2O Cloud Discovery Python CLient

Project description

h2o-cloud-discovery

licence pypi

H2O Cloud Discovery Client.

Installation

pip install h2o-cloud-discovery

Usage

Package provides single async function h2o_discovery.discover() that returns a discovery object that can be used to obtain the information the H2O Cloud environment, its services and clients.

It accepts a environment argument that can be used to specify the H2O Cloud environment for which the discovery should be performed. It's handy when for local development. Alternatively, the H2O_CLOUD_ENVIRONMENT environment variable can be used.

import h2o_discovery

discovery = await h2o_discovery.discover()

# Print the H2O Cloud environment that was discovered.
print(discovery.environment.h2o_cloud_environment)

# Connect to the my service.
my_service_client = my_service.client(address=discovery.services["my-service"].uri)

Examples

Example: Use with H2O.ai MLOps Python Client within the Wave App

import h2o_authn
import h2o_discovery
import h2o_mlops_client as mlops
from h2o_wave import Q, app, ui
from h2o_wave import main

@app("/")
async def serve(q: Q):
    discovery = await h2o_discovery.discover()

    token_provider = h2o_authn.AsyncTokenProvider(
        refresh_token=q.auth.refresh_token,
        issuer_url=discovery.environment.issuer_url,
        client_id=discovery.clients["platform"].oauth2_client_id,
    )

    mlops_client = mlops.Client(
        gateway_url=discovery.services["mlops-api"].uri,
        token_provider=token_provider,
    )

    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

h2o_cloud_discovery-0.1.0a1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

h2o_cloud_discovery-0.1.0a1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file h2o_cloud_discovery-0.1.0a1.tar.gz.

File metadata

  • Download URL: h2o_cloud_discovery-0.1.0a1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for h2o_cloud_discovery-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 b23510700475797ca6a98c848182c4f3be116f10d3eb9503fd6f6d745caf041b
MD5 2e36992f2806a506513d426103f7ee97
BLAKE2b-256 62877c1b3de85fa16e01f481671275ce94665b78aea4a8d4e0202522324468c1

See more details on using hashes here.

File details

Details for the file h2o_cloud_discovery-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for h2o_cloud_discovery-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d036f178608e08199ba9e37247d3dd202dafde84088db10ca8c9ca36dda32a30
MD5 1a59e2fe0947d8e8725af535851f2a45
BLAKE2b-256 d0f8e4c1646b2269365828841d3256380e53ce0ba3a69f873c0a8d347250ddce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page