{"id":22793406,"url":"https://github.com/fivetran/pyhvr","last_synced_at":"2025-04-30T15:26:51.665Z","repository":{"id":40363282,"uuid":"411533517","full_name":"fivetran/pyhvr","owner":"fivetran","description":"Python wrapper module for HVR REST API ","archived":false,"fork":false,"pushed_at":"2023-05-22T19:08:13.000Z","size":160,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-03-30T17:23:17.500Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Roff","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fivetran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-29T04:48:11.000Z","updated_at":"2025-03-24T02:13:03.000Z","dependencies_parsed_at":"2025-02-05T18:59:30.633Z","dependency_job_id":null,"html_url":"https://github.com/fivetran/pyhvr","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fpyhvr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fpyhvr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fpyhvr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fpyhvr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fivetran","download_url":"https://codeload.github.com/fivetran/pyhvr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251730853,"owners_count":21634466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-12T03:19:47.117Z","updated_at":"2025-04-30T15:26:51.637Z","avatar_url":"https://github.com/fivetran.png","language":"Roff","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyHvr\n\nA Python module to access the REST API of HVR (version 6).\n\nThis module is a wrapper of the API as described in https://www.hvr-software.com/docs/6/rest-api/rest-api-reference and thus the same documentation and the same workflow applies. This code is automatically generated and the function names are created from the API paths, too, although a few have been renamed to prevent duplicates.\n\n## Usage\n\n### Install pyhvr\n\nPoint `pip` to this git repository:\n\n```bash\npip install git+https://github.com/hvrsoftware/pyhvr.git@v6.1.0.3#egg=pyhvr\n```\n\n### Create a client\n\nThe standard client needs username, password and the URI of the hub.\n\n```python\nimport pyhvr\nhvr_client = pyhvr.client(\n    username=\"admin\", password=\"password1234\", uri=\"http://localhost:4340\"\n)\n```\n\nCreating a client does not establish a connection, it's a cheap operation that cannot fail. It is possible to call `hvr_client.login()` to force the login to happen and thus to check that the credentials and URI validity.\n\nThe explicit login call is optional - any further API operation will call login if necessary.\n\n#### Setup mode\n\nWhen the hub starts for the first time, there is no admin user created yet. It is possible to do the initial setup using PyHvr, too, using so called \"setup mode client\":\n\n```python\nimport pyhvr\npyhvr.client_setup_mode(uri=\"http://localhost:4340\")\n```\n\nSee [tests/test_clean_install.py](tests/test_clean_install.py) for the required steps to set a valid license, create the admin user and hub repository database. The test also include steps to register new agents.\n\n### Using the client\n\nAll error codes of the API (4xx, 5xx) are turned into Python exceptions. Generally, `ConnectionError` is for invalid URI or network issues, `LoginError` for invalid credentials and `RestError` for any error returned by the API. All of these derive from `PyhvrError`.\n\nThe returned value is a dictionary when the API returns JSON (vast majority of calls) or a string for text/plain.\n\nThe function parameters are either plain strings/numbers, or dictionaries. We understand that the use case for PyHvr is controlling or monitoring an HVR installation, not to do complex transformations on internal HVR objects. Thus we did not create bespoke classes for the different HVR objects like connections or locations; instead, we wanted to a simple-to-use module that makes day-to-day scripting easy.\n\n```python\nimport pyhvr\nhvr_client = pyhvr.client(\n    username=\"admin\", password=\"password1234\", uri=\"http://localhost:4340\"\n)\n\ntry:\n    hvr_client.put_hubs_definition_locs(\n        hub=\"hvrhub\",\n        loc=\"sourceloc\",\n        props={\n            \"Database_Host\": \"postgres-source\",\n            \"Database_Port\": 5432,\n            \"Database_Name\": \"tpcc\",\n            \"Database_User\": \"postgres\",\n            \"Database_Password\": \"secret1234\",\n            \"Class\": \"postgresql\",\n            \"Capture_Method\": \"SQL\",\n            \"Agent_Host\": \"agent-1\",\n            \"Agent_Port\": \"4343\",\n        },\n    )\n\n    ...\n\n    add = hvr_client.post_hubs_channels_locs_adapt_apply(\n        hub=\"hvrhub\",\n        channel=\"channel\",\n        loc=\"sourceloc\",\n        add_table_group={\"group\": \"GENERAL\"},\n        add_tables=True,\n        mapspec={\"tables\": [{\"schema\": \"public\", \"base_name\": \"customer\"}]},\n    )\n\n    assert add == {\n        \"add_tables\": [\n            {\n                \"base_name\": \"customer\",\n                \"schema\": \"public\",\n                \"table\": \"customer\",\n                \"type\": \"Table\",\n            }\n        ]\n    }\nexcept when PyhvrError as e:\n    print(e.message)\n```\n\nThe `pytest` tests in [testing/](testing/) directory show more examples how to use this module.\n\n## Generating PyHvr\n\nThe code used to generate the pyhvr module is a part of this repository, too. See [pyhvr-generate/](pyhvr-generate/). This code is tested by GitHub Workflow, too.\n\n## Supported versions\n\nPython versions 3.6, 3.7, 3.8 and 3.9 are tested and supported.\n\nHVR 6.1.0.3 GA is the only supported version at this time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fpyhvr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffivetran%2Fpyhvr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fpyhvr/lists"}