weheat


Nameweheat JSON
Version 2025.2.27 PyPI version JSON
download
home_pagehttps://github.com/wefabricate/wh-python
SummaryWeheat Backend client
upload_time2025-02-26 19:21:28
maintainerNone
docs_urlNone
authorJesper Raemaekers
requires_pythonNone
licenseMIT
keywords openapi openapi-generator weheat backend
VCS
bugtrack_url
requirements python_dateutil setuptools urllib3 pydantic typing-extensions aiohttp aiohttp-retry
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Weheat backend client

This is a client for the Weheat backend. It is automatically generated from the OpenAPI specification.

## Requirements.

Python 3.7+

## Installation & Usage

You can install directly using:

```sh
pip install weheat
```

Then import the package:

```python
import weheat
```



## Getting Started

After installation, you can now use the client to interact with the Weheat backend. Note that all methods are async as of version 2025.1.15.

```python
import asyncio
import datetime
from keycloak import KeycloakOpenID  # install with pip install python-keycloak
from weheat import ApiClient, Configuration, HeatPumpApi, HeatPumpLogApi, EnergyLogApi, UserApi

auth_url = 'https://auth.weheat.nl/auth/'
api_url = 'https://api.weheat.nl'
realm_name = 'Weheat'
my_client_id = 'WeheatCommunityAPI' # client ID and secret provided by Weheat
my_client_secret = ''
username = '' # username and password used for the online portal
password = ''
my_heat_pump_id = '' # your heat pump UUID


async def demo():
    keycloak_open_id = KeycloakOpenID(server_url=auth_url,
                                      client_id=my_client_id,
                                      realm_name=realm_name,
                                      client_secret_key=my_client_secret)

    token_response = keycloak_open_id.token(username, password)
    keycloak_open_id.logout(token_response['refresh_token'])

    config = Configuration(host=api_url, access_token=token_response['access_token'])
    async with ApiClient(configuration=config) as client:
        response = await UserApi(client).api_v1_users_me_get_with_http_info()

        if response.status_code == 200:
            print(f'My user: {response.data}')

        response = await HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info()

        if response.status_code == 200:
            print(f'My heat pump: {response.data}')

        response = await HeatPumpLogApi(client).api_v1_heat_pumps_heat_pump_id_logs_latest_get_with_http_info(
            heat_pump_id=my_heat_pump_id)

        if response.status_code == 200:
            print(f'My heat pump logs: {response.data}')

        response = await EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=my_heat_pump_id,
                                                                                     start_time=datetime.datetime(2024, 6,
                                                                                                                  22, 0, 0,
                                                                                                                  0),
                                                                                     end_time=datetime.datetime(2024, 6, 22,
                                                                                                                15, 0, 0),
                                                                                     interval='Hour')

        if response.status_code == 200:
            print(f'My energy logs: {response.data}')

asyncio.get_event_loop().run_until_complete(demo())

```




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wefabricate/wh-python",
    "name": "weheat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "OpenAPI, OpenAPI-Generator, Weheat Backend",
    "author": "Jesper Raemaekers",
    "author_email": "jesper.raemaekers@wefabricate.com",
    "download_url": "https://files.pythonhosted.org/packages/1a/ff/62fd45bc201b16620a784c62e5d5f39dedb2a8945960705fcbed1d2749ba/weheat-2025.2.27.tar.gz",
    "platform": null,
    "description": "# Weheat backend client\n\nThis is a client for the Weheat backend. It is automatically generated from the OpenAPI specification.\n\n## Requirements.\n\nPython 3.7+\n\n## Installation & Usage\n\nYou can install directly using:\n\n```sh\npip install weheat\n```\n\nThen import the package:\n\n```python\nimport weheat\n```\n\n\n\n## Getting Started\n\nAfter installation, you can now use the client to interact with the Weheat backend. Note that all methods are async as of version 2025.1.15.\n\n```python\nimport asyncio\nimport datetime\nfrom keycloak import KeycloakOpenID  # install with pip install python-keycloak\nfrom weheat import ApiClient, Configuration, HeatPumpApi, HeatPumpLogApi, EnergyLogApi, UserApi\n\nauth_url = 'https://auth.weheat.nl/auth/'\napi_url = 'https://api.weheat.nl'\nrealm_name = 'Weheat'\nmy_client_id = 'WeheatCommunityAPI' # client ID and secret provided by Weheat\nmy_client_secret = ''\nusername = '' # username and password used for the online portal\npassword = ''\nmy_heat_pump_id = '' # your heat pump UUID\n\n\nasync def demo():\n    keycloak_open_id = KeycloakOpenID(server_url=auth_url,\n                                      client_id=my_client_id,\n                                      realm_name=realm_name,\n                                      client_secret_key=my_client_secret)\n\n    token_response = keycloak_open_id.token(username, password)\n    keycloak_open_id.logout(token_response['refresh_token'])\n\n    config = Configuration(host=api_url, access_token=token_response['access_token'])\n    async with ApiClient(configuration=config) as client:\n        response = await UserApi(client).api_v1_users_me_get_with_http_info()\n\n        if response.status_code == 200:\n            print(f'My user: {response.data}')\n\n        response = await HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info()\n\n        if response.status_code == 200:\n            print(f'My heat pump: {response.data}')\n\n        response = await HeatPumpLogApi(client).api_v1_heat_pumps_heat_pump_id_logs_latest_get_with_http_info(\n            heat_pump_id=my_heat_pump_id)\n\n        if response.status_code == 200:\n            print(f'My heat pump logs: {response.data}')\n\n        response = await EnergyLogApi(client).api_v1_energy_logs_heat_pump_id_get_with_http_info(heat_pump_id=my_heat_pump_id,\n                                                                                     start_time=datetime.datetime(2024, 6,\n                                                                                                                  22, 0, 0,\n                                                                                                                  0),\n                                                                                     end_time=datetime.datetime(2024, 6, 22,\n                                                                                                                15, 0, 0),\n                                                                                     interval='Hour')\n\n        if response.status_code == 200:\n            print(f'My energy logs: {response.data}')\n\nasyncio.get_event_loop().run_until_complete(demo())\n\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Weheat Backend client",
    "version": "2025.2.27",
    "project_urls": {
        "Homepage": "https://github.com/wefabricate/wh-python"
    },
    "split_keywords": [
        "openapi",
        " openapi-generator",
        " weheat backend"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a6b159e82b3ba73c5a2679f1aadf297974e361d450b384ed492957f795f5aa49",
                "md5": "b036b36423469c437ee2c80e8c968f8c",
                "sha256": "3554008fb9bab1a732855304b6be3d3ce0883539360be0fe05dcc974197f990e"
            },
            "downloads": -1,
            "filename": "weheat-2025.2.27-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b036b36423469c437ee2c80e8c968f8c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 60484,
            "upload_time": "2025-02-26T19:21:26",
            "upload_time_iso_8601": "2025-02-26T19:21:26.661504Z",
            "url": "https://files.pythonhosted.org/packages/a6/b1/59e82b3ba73c5a2679f1aadf297974e361d450b384ed492957f795f5aa49/weheat-2025.2.27-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1aff62fd45bc201b16620a784c62e5d5f39dedb2a8945960705fcbed1d2749ba",
                "md5": "380d5d747f9ce4258eb2e39fead43a5a",
                "sha256": "3a334bf077dd407526544693e1892bdb4143e8b769b701e6e053556f56d40a36"
            },
            "downloads": -1,
            "filename": "weheat-2025.2.27.tar.gz",
            "has_sig": false,
            "md5_digest": "380d5d747f9ce4258eb2e39fead43a5a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 43906,
            "upload_time": "2025-02-26T19:21:28",
            "upload_time_iso_8601": "2025-02-26T19:21:28.588197Z",
            "url": "https://files.pythonhosted.org/packages/1a/ff/62fd45bc201b16620a784c62e5d5f39dedb2a8945960705fcbed1d2749ba/weheat-2025.2.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-26 19:21:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wefabricate",
    "github_project": "wh-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "python_dateutil",
            "specs": [
                [
                    ">=",
                    "2.5.3"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "21.0.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "<",
                    "2.1.0"
                ],
                [
                    ">=",
                    "1.25.3"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.7.1"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "aiohttp-retry",
            "specs": [
                [
                    ">=",
                    "2.8.3"
                ]
            ]
        }
    ],
    "lcname": "weheat"
}
        
Elapsed time: 1.15140s