H2O Cloud Discovery Python CLient
Project description
h2o-cloud-discovery
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for h2o_cloud_discovery-0.2.0a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e19eab35658d95ff66de5346f887c16617037f9b6bd628d3bcc3e8a11c9e8b1d |
|
MD5 | 25892a7586bf914fda567df5779191eb |
|
BLAKE2b-256 | 2986d466bf601564c9294981c6a8ac10b12f0f38a64acd83484b4fa21ad3a11a |
Close
Hashes for h2o_cloud_discovery-0.2.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e1944c835c652a80ee5ca1201ee5bf8cef62281e7e80bbda585e968cb1724d5 |
|
MD5 | 0ad2589efa9841fbc714a621ba2427df |
|
BLAKE2b-256 | 8350bc30bd5c650474308a943044e3e651acfcfca1e7453bd4f07cfa8ec71cb1 |