# Path: newrelic_api/exceptions.py
# class ConfigurationException(Exception):
#     """
#     An exception for Configuration errors
#     """
#     message = 'There was an error in the configuration'
# 
# class NewRelicAPIServerException(Exception):
#     """
#     An exception for New Relic server errors
#     """
#     message = 'There was an error from New Relic'


import os
import json
import requests
from newrelic_api.exceptions import ConfigurationException, NewRelicAPIServerException




class Resource(object):
    """
    A base class for API resources
    """
    URL = 'https://api.newrelic.com/v2/'

    def __init__(self, api_key=None):
        """
        :type api_key: str
        :param api_key: The API key. If no key is passed, the environment
            variable NEW_RELIC_API_KEY is used.
        :raises: If the api_key parameter is not present, and no environment
            variable is present, a :class:`newrelic_api.exceptions.ConfigurationException`
            is raised.
        """
        self.api_key = api_key or os.environ.get('NEW_RELIC_API_KEY') or os.environ.get('NEWRELIC_API_KEY')

        if not self.api_key:

# Path: newrelic_api/exceptions.py
# class ConfigurationException(Exception):
#     """
#     An exception for Configuration errors
#     """
#     message = 'There was an error in the configuration'
# 
# class NewRelicAPIServerException(Exception):
#     """
#     An exception for New Relic server errors
#     """
#     message = 'There was an error from New Relic'


# Path: newrelic_api/base.py
import os
import json
import requests
from newrelic_api.exceptions import ConfigurationException, NewRelicAPIServerException





class Resource(object):
    """
    A base class for API resources
    """
    URL = 'https://api.newrelic.com/v2/'

    def __init__(self, api_key=None):
        """
        :type api_key: str
        :param api_key: The API key. If no key is passed, the environment
            variable NEW_RELIC_API_KEY is used.
        :raises: If the api_key parameter is not present, and no environment
            variable is present, a :class:`newrelic_api.exceptions.ConfigurationException`
            is raised.
        """
        self.api_key = api_key or os.environ.get('NEW_RELIC_API_KEY') or os.environ.get('NEWRELIC_API_KEY')

        if not self.api_key:

            raise ConfigurationException('NEW_RELIC_API_KEY or NEWRELIC_API_KEY not present in environment!')