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
h2o_cloud_discovery-1.0.1.tar.gz
(14.7 kB
view hashes)
Built Distribution
Close
Hashes for h2o_cloud_discovery-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18648f81107a392e0be998f41934863b91f97c931f076cb5dc3816a73ea3f262 |
|
MD5 | a62c70d20d34d103f27aae76900cb4c0 |
|
BLAKE2b-256 | 29c6acb8088ef933f10334acbc333ff2568b75261e86a850d72574dded49bcdd |
Close
Hashes for h2o_cloud_discovery-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7523f5816ceb167968d5475bd75e280552edacdce559764177eade2c8b96b969 |
|
MD5 | 63f9f47bce754b334b9cb6f46080f61f |
|
BLAKE2b-256 | f072bd6c97468b7fec796523818c6644b50de4fc257541bc68d9e368539e408f |