weheat-backend-client


Nameweheat-backend-client JSON
Version 2024.6.19rc3 PyPI version JSON
download
home_pagehttps://github.com/wefabricate/wh-public-backend-client
SummaryWeheat Backend client
upload_time2024-07-09 19:18:51
maintainerNone
docs_urlNone
authorJesper Raemaekers
requires_pythonNone
licenseNone
keywords openapi openapi-generator weheat backend
VCS
bugtrack_url
requirements No requirements were recorded.
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_backend_client
```

Then import the package:
```python
import weheat_backend_client
```



## Getting Started

After installation, you can now use the client to interact with the Weheat backend.

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

# input your information here
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

# Get the access token from keycloak
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'])

# Create the cinfiguration object
config = Configuration(host=api_url, access_token=token_response['access_token'])

# with the client the APIs can be accessed
with ApiClient(configuration=config) as client:
    # Getting all heat pumps that the user has access to
    response = HeatPumpApi(client).api_v1_heat_pumps_get_with_http_info()

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

    # Getting the latest log of the heat pump
    response = 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}')

    # Getting the energy logs of the heat pump in a specific period
    # interval can be  "Minute", "FiveMinute", "FifteenMinute", "Hour", "Day", "Week", "Month", "Year"
    response = 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}')


```




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wefabricate/wh-public-backend-client",
    "name": "weheat-backend-client",
    "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/d9/19/8cb99a0e5050c6e58546c32a3382d605ea5a91597964c27ac8069cd6976e/weheat_backend_client-2024.6.19rc3.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_backend_client\n```\n\nThen import the package:\n```python\nimport weheat_backend_client\n```\n\n\n\n## Getting Started\n\nAfter installation, you can now use the client to interact with the Weheat backend.\n\n```python\nimport datetime\nfrom keycloak import KeycloakOpenID  # install with pip install python-keycloak\nfrom weheat_backend_client import ApiClient, Configuration, HeatPumpApi, HeatPumpLogApi, EnergyLogApi\n\n# input your information here\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# Get the access token from keycloak\nkeycloak_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\ntoken_response = keycloak_open_id.token(username, password)\nkeycloak_open_id.logout(token_response['refresh_token'])\n\n# Create the cinfiguration object\nconfig = Configuration(host=api_url, access_token=token_response['access_token'])\n\n# with the client the APIs can be accessed\nwith ApiClient(configuration=config) as client:\n    # Getting all heat pumps that the user has access to\n    response = 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    # Getting the latest log of the heat pump\n    response = 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    # Getting the energy logs of the heat pump in a specific period\n    # interval can be  \"Minute\", \"FiveMinute\", \"FifteenMinute\", \"Hour\", \"Day\", \"Week\", \"Month\", \"Year\"\n    response = 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\n\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Weheat Backend client",
    "version": "2024.6.19rc3",
    "project_urls": {
        "Homepage": "https://github.com/wefabricate/wh-public-backend-client"
    },
    "split_keywords": [
        "openapi",
        " openapi-generator",
        " weheat backend"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "169719dfe7967912d129f1963f5fa11e0ff27c0fff775093826212e3b5c243ed",
                "md5": "cf1ec2aa8b8b006668e1c99c570f673f",
                "sha256": "8e7db2cc179f943ded06e437362c1ff40896b3f54b61f4b531c664a79ad86d53"
            },
            "downloads": -1,
            "filename": "weheat_backend_client-2024.6.19rc3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf1ec2aa8b8b006668e1c99c570f673f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 52912,
            "upload_time": "2024-07-09T19:18:49",
            "upload_time_iso_8601": "2024-07-09T19:18:49.451304Z",
            "url": "https://files.pythonhosted.org/packages/16/97/19dfe7967912d129f1963f5fa11e0ff27c0fff775093826212e3b5c243ed/weheat_backend_client-2024.6.19rc3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9198cb99a0e5050c6e58546c32a3382d605ea5a91597964c27ac8069cd6976e",
                "md5": "5c333953f1ad705ec7a66ae5ca6dfdf2",
                "sha256": "18870fb62384032bd18c9c30f3ec2ce6985f4becab92b23aa4f39fe7d4cda769"
            },
            "downloads": -1,
            "filename": "weheat_backend_client-2024.6.19rc3.tar.gz",
            "has_sig": false,
            "md5_digest": "5c333953f1ad705ec7a66ae5ca6dfdf2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 39420,
            "upload_time": "2024-07-09T19:18:51",
            "upload_time_iso_8601": "2024-07-09T19:18:51.590995Z",
            "url": "https://files.pythonhosted.org/packages/d9/19/8cb99a0e5050c6e58546c32a3382d605ea5a91597964c27ac8069cd6976e/weheat_backend_client-2024.6.19rc3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-09 19:18:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wefabricate",
    "github_project": "wh-public-backend-client",
    "github_not_found": true,
    "lcname": "weheat-backend-client"
}
        
Elapsed time: 0.44709s