Exemple #1
0
 def setup_networks(self):
     """Get network information."""
     response = api.request_networks(self)
     try:
         self.networks = response["summary"]
     except (KeyError, TypeError):
         raise BlinkSetupError
Exemple #2
0
 def get_networks(self):
     """Get network information."""
     response = api.request_networks(self)
     try:
         return response["summary"]
     except KeyError:
         return None
Exemple #3
0
def check_login():
    try:
        #ret = blinkapi.http_get(blink, 'https://rest.prod.immedia-semi.com/health')
        ret = blinkapi.request_networks(blink)
    except (BlinkException, AttributeError):
        ret = {}
    print("Networks: %s" % ret)
    if ret:
        return True
    else:
        return False
Exemple #4
0
    def get_ids(self):
        """Set the network ID and Account ID."""
        response = api.request_networks(self)
        all_networks = []
        network_dict = {}
        for network, status in self.networks.items():
            if status['onboarded']:
                all_networks.append('{}'.format(network))
                network_dict[status['name']] = network

        # For the first onboarded network we find, grab the account id
        for resp in response['networks']:
            if str(resp['id']) in all_networks:
                self.account_id = resp['account_id']
                break

        self.network_ids = all_networks
        return network_dict