Skip to main content

Python client download and overview

This page provides an overview of the H2O eScorer Python client.

Deprecation notice

The eScorerAsyncClient method has been deprecated in favor of the Client class.

Download the Python client

To download the H2O eScorer Python client wheel, click the Python client tab in the H2O eScorer downloads page. You can then install the downloaded Python client wheel.

The h2o_escorer Python package

The Python package h2o_escorer provides the Python driver for H2O eScorer. It's a lightweight package with a single class, Client, that provides a simple API with asynchronous functions. These can be used to authenticate and make predictions using models deployed on the H2O AI Cloud.

Authentication

  • Authenticating h2o_escorer with H2O AI Cloud (HAIC) requires an HAIC platform token. You can get an HAIC platform token from the HAIC UI by clicking CLI & API Access and then clicking the generate token link in the Connect to the platform section. For more information, see Get the platform token.

  • This Python code authenticates with H2O AI Cloud using a platform token and sets up a client to interact with the H2O eScorer service. It uses the TokenProvider to securely manage the token and initializes the Client class for sending asynchronous scoring requests.

    from h2o_authn import TokenProvider
    import getpass

    print(f"Visit https://internal.dedicated.h2o.ai/auth/get-platform-token to get your platform token")
    token_provider = TokenProvider(
    refresh_token=getpass.getpass('Enter your platform token: '),
    client_id="hac-platform-public",
    token_endpoint_url="https://auth.internal.dedicated.h2o.ai/auth/realms/hac/protocol/openid-connect/token"
    )

    from h2o_escorer import Client
    client = Client(
    escorer_url="https://rest-scorer.internal.dedicated.h2o.ai",
    token_provider=token_provider
    )

Feedback