How to use the qhue.create_new_username function in qhue

To help you get started, we’ve selected a few qhue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cryzed / Amby / amby / cli.py View on Github external
def prompt_create_username(bridge_address):
    choice = input('No username specified, do you want to create one now? [Y/n]: ')
    if choice.lower() in {'', 'y', 'yes'}:
        try:
            return qhue.create_new_username(bridge_address)
        except QhueException as exception:
            stderr(f'Exception occurred while creating the username: {exception}')
github fredley / raspi-turntouch / controllers / hue_controller.py View on Github external
def __init__(self):
        try:
            with open('.hueusername') as f:
                bridge_data = json.loads(f.read())
        except:
            logger.warn("Bridge not authorised, need to press the button!")
            bridge_data = json.loads(
                requests.get('https://www.meethue.com/api/nupnp').text)[0]
            bridge_data['username'] = create_new_username(
                    bridge_data['internalipaddress'])
            with open('.hueusername', 'w') as f:
                f.write(json.dumps(bridge_data))
        self.bridge = Bridge(bridge_data['internalipaddress'], bridge_data['username'])
        logger.info("Successfully connected to Hue Bridge {}".format(bridge_data['internalipaddress']))

qhue

Qhue: python wrapper for Philips Hue API

GPL-2.0
Latest version published 3 years ago

Package Health Score

39 / 100
Full package analysis