h2o-py/h2o/h2o.py
def download_pojo(model, path="", get_jar=True, jar_name=""):
    """
    Download the POJO for this model to the directory specified by path; if path is "", then dump to screen.

    :param model: the model whose scoring POJO should be retrieved.
    :param path: an absolute path to the directory where POJO should be saved.
    :param get_jar: retrieve the h2o-genmodel.jar also (will be saved to the same folder ``path``).
    :param jar_name: Custom name of genmodel jar.
    :returns: location of the downloaded POJO file.
    """
    assert_is_type(model, ModelBase)
    assert_is_type(path, str)
    assert_is_type(get_jar, bool)

    if not model.have_pojo:
        raise H2OValueError("Export to POJO not supported")

    if path == "":
        java_code = api("GET /3/Models.java/%s" % model.model_id)
        print(java_code)
        return None
    else:
        filename = api("GET /3/Models.java/%s" % model.model_id, save_to=path)
        if get_jar:
            if jar_name == "":
                api("GET /3/h2o-genmodel.jar", save_to=os.path.join(path, "h2o-genmodel.jar"))
            else:
                api("GET /3/h2o-genmodel.jar", save_to=os.path.join(path, jar_name))
        return filename
def download_pojo(model, path="", get_jar=True, jar_name=""):
    """
    Download the POJO for this model to the directory specified by path; if path is "", then dump to screen.

    :param model: the model whose scoring POJO should be retrieved.
    :param path: an absolute path to the directory where POJO should be saved.
    :param get_jar: retrieve the h2o-genmodel.jar also (will be saved to the same folder ``path``).
    :param jar_name: Custom name of genmodel jar.
    :returns: location of the downloaded POJO file.
    """
    assert_is_type(model, ModelBase)
    assert_is_type(path, str)
    assert_is_type(get_jar, bool)

    if not model.have_pojo:
        raise H2OValueError("Export to POJO not supported")

    if path == "":
        java_code = api("GET /3/Models.java/%s" % model.model_id)
        print(java_code)
        return None
    else:
        filename = api("GET /3/Models.java/%s" % model.model_id, save_to=path)
        if get_jar:
            if jar_name == "":
                api("GET /3/h2o-genmodel.jar", save_to=os.path.join(path, "h2o-genmodel.jar"))
            else:
                api("GET /3/h2o-genmodel.jar", save_to=os.path.join(path, jar_name))
        return filename
Download the POJO for this model to the directory specified by path; if path is "", then dump to screen.

    :param model: the model whose scoring POJO should be retrieved.
    :param path: an absolute path to the directory where POJO should be saved.
    :param get_jar: retrieve the h2o-genmodel.jar also (will be saved to the same folder ``path``).
    :param jar_name: Custom name of genmodel jar.
    :returns: location of the downloaded POJO file.