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 two main functions. Synchronous h2o_discovery.discover() and asynchronous h2o_discovery.discover_async(). Both functions return a discovery object that can be used to obtain the information the H2O Cloud environment, its services and clients.

Both accept 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 = 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_async()

    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-1.0.0rc1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

h2o_cloud_discovery-1.0.0rc1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file h2o_cloud_discovery-1.0.0rc1.tar.gz.

File metadata

File hashes

Hashes for h2o_cloud_discovery-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 eea0c9bc3ab943cf9f73e4a295cdfcce91de8769a4eca95b2082d20e59800306
MD5 b7eaa97cccc4711b6ee7adcf5b5f27ee
BLAKE2b-256 41751dec5be389ca88bb58d9143dae0dac805988019702f52b296596ffdbb8e7

See more details on using hashes here.

File details

Details for the file h2o_cloud_discovery-1.0.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for h2o_cloud_discovery-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 a79ecbf7c08d22e9074e3aaf4b7bdec4d4053e82555ec904b73bfca6c01b6d2f
MD5 ec97244b9caaccd27bc3f6e75c0edd68
BLAKE2b-256 2a41a697d0f0b8110f37ab21df645b7d82ec8bcd725ba02cb98cdf24e9c8a9b8

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