def get_devices(device_type): arequest_url = "{}/users/me/wink_devices".format(WinkApiInterface.BASE_URL) response = requests.get(arequest_url, headers=API_HEADERS) if response.status_code == 200: response_dict = response.json() filter_key = DEVICE_ID_KEYS.get(device_type) return get_devices_from_response_dict(response_dict, filter_key) if response.status_code == 401: raise WinkAPIException("401 Response from Wink API. Maybe Bearer token is expired?") else: raise WinkAPIException("Unexpected")
def get_devices(device_type): arequest_url = "{}/users/me/wink_devices".format(WinkApiInterface.BASE_URL) response = requests.get(arequest_url, headers=API_HEADERS) if response.status_code == 200: response_dict = response.json() filter_key = DEVICE_ID_KEYS.get(device_type) return get_devices_from_response_dict(response_dict, filter_key) if response.status_code == 401: raise WinkAPIException( "401 Response from Wink API. Maybe Bearer token is expired?") else: raise WinkAPIException("Unexpected")
def get_devices(device_type): response_dict = wink_api_fetch() filter_key = DEVICE_ID_KEYS.get(device_type) return get_devices_from_response_dict(response_dict, filter_key)
def get_devices(device_type): response_dict = wink_api_fetch() filter_key = DEVICE_ID_KEYS.get(device_type) return get_devices_from_response_dict(response_dict, filter_key)