示例#1
0
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")
示例#2
0
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")
示例#3
0
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)
示例#4
0
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)