# Path: cozify/Error.py
# class APIError(Exception):
#     """Error raised for non-200 API return codes
# 
#     Args:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     
#     Attributes:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     """
# 
#     def __init__(self, status_code, message):
#         self.status_code = status_code
#         self.message = message
# 
#     def __str__(self):
#         return 'API error, {code}: {message}'.format(code=self.status_code, message=self.message)
# 
# class AuthenticationError(Exception):
#     """Error raised for nonrecoverable authentication failures.
# 
#     Args:
#         message(str): Human readable error description
#     
#     Attributes:
#         message(str): Human readable error description
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Authentication error: {}'.format(self.message)
# 
# class ConnectionError(ConnectionError):
#     """Error raised for connection level failures,
#     such as a lost internet connection.
# 
#     Args:
#         message(str): Potential error message returned by the requests library
# 
#     Attributes:
#         message(str): Potential error message returned by the requests library
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Connection error: {}'.format(self.message)


import json
import requests
from .Error import APIError, AuthenticationError, ConnectionError
            else:
                raise AttributeError('PUT call with no data, this would fail!')
        elif method is requests.post:
            if data and params:
                response = method(call, headers=headers, data=data, params=params, timeout=5)
            elif data:
                response = method(call, headers=headers, data=data, timeout=5)
            elif params:
                response = method(call, headers=headers, params=params, timeout=5)
            else:
                raise AttributeError(
                    'POST call with no data or params, this probably makes no sense!')

        elif params:
            response = method(call, headers=headers, params=params, timeout=5)
        else:
            response = method(call, headers=headers, timeout=5)

    except requests.exceptions.RequestException as e:  # pragma: no cover
        raise ConnectionError(str(e)) from None

    if response.status_code == 200:
        if raw:
            return response
        if json_output:
            return response.json()
        else:
            return response.text

    elif response.status_code == 410:

# Path: cozify/Error.py
# class APIError(Exception):
#     """Error raised for non-200 API return codes
# 
#     Args:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     
#     Attributes:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     """
# 
#     def __init__(self, status_code, message):
#         self.status_code = status_code
#         self.message = message
# 
#     def __str__(self):
#         return 'API error, {code}: {message}'.format(code=self.status_code, message=self.message)
# 
# class AuthenticationError(Exception):
#     """Error raised for nonrecoverable authentication failures.
# 
#     Args:
#         message(str): Human readable error description
#     
#     Attributes:
#         message(str): Human readable error description
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Authentication error: {}'.format(self.message)
# 
# class ConnectionError(ConnectionError):
#     """Error raised for connection level failures,
#     such as a lost internet connection.
# 
#     Args:
#         message(str): Potential error message returned by the requests library
# 
#     Attributes:
#         message(str): Potential error message returned by the requests library
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Connection error: {}'.format(self.message)


# Path: cozify/cloud_api.py
import json
import requests
from .Error import APIError, AuthenticationError, ConnectionError

            else:
                raise AttributeError('PUT call with no data, this would fail!')
        elif method is requests.post:
            if data and params:
                response = method(call, headers=headers, data=data, params=params, timeout=5)
            elif data:
                response = method(call, headers=headers, data=data, timeout=5)
            elif params:
                response = method(call, headers=headers, params=params, timeout=5)
            else:
                raise AttributeError(
                    'POST call with no data or params, this probably makes no sense!')

        elif params:
            response = method(call, headers=headers, params=params, timeout=5)
        else:
            response = method(call, headers=headers, timeout=5)

    except requests.exceptions.RequestException as e:  # pragma: no cover
        raise ConnectionError(str(e)) from None

    if response.status_code == 200:
        if raw:
            return response
        if json_output:
            return response.json()
        else:
            return response.text

    elif response.status_code == 410:

        raise APIError(