Base¶
newrelic_api.base¶
- class newrelic_api.base.Resource(api_key=None)¶
A base class for API resources
- __init__(api_key=None)¶
Parameters: api_key (str) – 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 newrelic_api.exceptions.ConfigurationException is raised.
- URL = 'https://api.newrelic.com/v2/'¶
- _delete(*args, **kwargs)¶
A wrapper for deleting things
Returns: The response of your delete Return type: dict Raises: This will raise a NewRelicAPIServerException if there is an error from New Relic
- _get(*args, **kwargs)¶
A wrapper for getting things
Returns: The response of your get Return type: dict Raises: This will raise a NewRelicAPIServerException if there is an error from New Relic
- _post(*args, **kwargs)¶
A wrapper for posting things. It will also json encode your ‘data’ parameter
Returns: The response of your post Return type: dict Raises: This will raise a NewRelicAPIServerException if there is an error from New Relic
- _put(*args, **kwargs)¶
A wrapper for putting things. It will also json encode your ‘data’ parameter
Returns: The response of your put Return type: dict Raises: This will raise a NewRelicAPIServerException if there is an error from New Relic
- build_param_string(params)¶
This is a simple helper method to build a parameter string. It joins all list elements that evaluate to True with an ampersand, ‘&’
>>> parameters = Resource().build_param_string(['filter[name]=dev', None, 'page=1']) >>> print parameters filter[name]=dev&page=1
Parameters: params (list) – The parameters to build a string with Return type: str Returns: The compiled parameter string