Overboard / discoverhue

Discovery of hue bridges per the Philips design guide.
MIT License
10 stars 1 forks source link

Only return IP address #3

Closed NicoHood closed 6 years ago

NicoHood commented 6 years ago

For the qhue API it is required to know the IP address without all the https:// stuff. It would be nice if you could add a simple function to also get the ip without this extra url.

This is the code I used to strip the URL:

found[bridge].split('/')[2].split(':')[0]
Overboard commented 6 years ago

I'm inclined to agree. I'm not certain that I like the full URL either. Perhaps, I'll subclass the return string to add a convenient 'strip' method.

In the meantime, you may want to consider:

>>> from urllib.parse import urlsplit
>>> urlsplit("http://192.168.0.1:80").hostname
'192.168.0.1'
Overboard commented 6 years ago

Retained the full URL as returned by description.xml, but now provide easy access to IP via a hostname attribute. See commit comments. If that isn't sufficient, please reopen.

NicoHood commented 6 years ago

Thanks! Could you please give it a new tag, so I can update the AUR Package?

It would be nice if you could consider to sign the package, so in further versions we can check the authenticity of the software. See #2

Overboard commented 6 years ago

I'll be rolling this up into a new release including tag and Pypi upload.

As for signing, I've no disagreement but I'm not yet set up to do so. I owe you a reply on #2 when I get a further look at GPGit

Overboard commented 6 years ago

Released/Tagged as https://github.com/Overboard/discoverhue/releases/tag/v1.0.2 and up on pypi