Skip to content

AttributeError: 'LoadBalancerService' object has no attribute '__api_properties__' #638

@TomHutter

Description

@TomHutter

Bug Report

Current Behavior
When calling lb.services you get an error:

AttributeError: 'LoadBalancerService' object has no attribute 'api_properties'

Input Code

  • REPL or Repo link if applicable:
from hcloud import Client
client = Client(token='...')
lb = client.load_balancers.get_all()[0]
lb.services
Traceback (most recent call last):
  File "<python-input-3>", line 1, in <module>
    lb.services
  File "/home/tom/DWBN/k3s-cluster/.venv/lib/python3.13/site-packages/hcloud/core/domain.py", line 28, in __repr__
    kwargs = [f"{key}={getattr(self, key)!r}" for key in self.__api_properties__]
                                                         ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LoadBalancerService' object has no attribute '__api_properties__'

Expected behavior/code

>>> lb.services
[LoadBalancerService(protocol='tcp', listen_port=6443, destination_port=6443, proxyprotocol=False, health_check=LoadBalancerHealthCheck(protocol='tcp', port=6443, interval=15, timeout=10, retries=3, http=None), http=None)]

Environment

  • Python Version: Python 3.13.12 (main, Feb 3 2026, 17:53:27) [GCC 14.3.0] on linux
  • Hcloud-Python Version: hcloud-2.17.0

Possible Solution

Add api_properties to class LoadBalancerService:

class LoadBalancerService(BaseDomain):
    """LoadBalancerService Domain

    :param protocol: str
           Protocol of the service Choices: tcp, http, https
    :param listen_port: int
           Required when protocol is tcp, must be unique per Load Balancer.
    :param destination_port: int
           Required when protocol is tcp
    :param proxyprotocol: bool
            Enable proxyprotocol
    :param health_check: LoadBalancerHealthCheck
            Configuration for health checks
    :param http: LoadBalancerServiceHttp
            Configuration for http/https protocols, required when protocol is http/https
    """
   
    __api_properties__ = (
        "protocol",
        "listen_port",
        "destination_port",
        "proxyprotocol",
        "health_check",
        "http",
    )
    __slots__ = __api_properties__

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions