Skip to content

Fix Call to IPAddress.is_private() removed method. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arouze
Copy link

@arouze arouze commented Oct 24, 2024

Hello 👋

Thanks for your work !
I have an issue with your package on homeassistant.

here the message when I try to access to the sensor :

ERROR (MainThread) [homeassistant.components.sensor] Error while setting up bbox platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/bbox/sensor.py", line 104, in setup_platform
    bbox_data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 184, in wrapper
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/bbox/sensor.py", line 198, in update
    box = pybbox.Bbox()
          ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pybbox/__init__.py", line 21, in __init__
    self.bbox_url = BboxAPIUrl(None, None, ip)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pybbox/bboxApiURL.py", line 25, in __init__
    self.build_url_request()
  File "/usr/local/lib/python3.12/site-packages/pybbox/bboxApiURL.py", line 53, in build_url_request
    if net.IPAddress(self.ip).is_private():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'IPAddress' object has no attribute 'is_private'

It seems that the is_private() method was delete in [email protected].
This PR just replace the is_private method by the is_ipv4_private_use (bbox use only ipv4 right ?! ).

BTW, I'm not a python developper, sooo if you want to check / drop / update by PR it's fine !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant