brynq-sdk-newrelic 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 1.0
2
+ Name: brynq_sdk_newrelic
3
+ Version: 1.0.0
4
+ Summary: Newrelic wrapper from BrynQ
5
+ Home-page: UNKNOWN
6
+ Author: BrynQ
7
+ Author-email: support@brynq.com
8
+ License: BrynQ License
9
+ Description: Newrelic wrapper from BrynQ
10
+ Platform: UNKNOWN
@@ -0,0 +1 @@
1
+ from brynq_sdk.newrelic.newrelic_interface import NewRelicAPI
@@ -0,0 +1,35 @@
1
+ from typing import Union, List
2
+ import requests
3
+ from brynq_sdk.brynq import BrynQ
4
+
5
+
6
+ class NewRelicAPI(BrynQ):
7
+
8
+ def __init__(self, label: Union[str, List], debug: bool = False):
9
+ """
10
+ For the full documentation, see: https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/
11
+ """
12
+ super().__init__()
13
+ self.headers = self._set_credentials(label)
14
+ self.url = "https://api.newrelic.com/graphql"
15
+
16
+ def _set_credentials(self, label):
17
+ """
18
+ Get the credentials from BrynQ and get the username and private key from there
19
+ """
20
+ credentials = self.get_system_credential(system='newrelic-api', label=label)
21
+ api_key = credentials['api_key']
22
+ headers = {
23
+ 'API-Key': f'{api_key}',
24
+ 'Content-Type': 'application/json'
25
+ }
26
+ return headers
27
+
28
+ def execute_query(self, query: dict):
29
+ response = requests.post(self.url, headers=self.headers, json=query)
30
+ if response.status_code == 200:
31
+ return response.json()
32
+ else:
33
+ response.raise_for_status()
34
+
35
+ return response
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 1.0
2
+ Name: brynq-sdk-newrelic
3
+ Version: 1.0.0
4
+ Summary: Newrelic wrapper from BrynQ
5
+ Home-page: UNKNOWN
6
+ Author: BrynQ
7
+ Author-email: support@brynq.com
8
+ License: BrynQ License
9
+ Description: Newrelic wrapper from BrynQ
10
+ Platform: UNKNOWN
@@ -0,0 +1,9 @@
1
+ setup.py
2
+ brynq_sdk/newrelic/__init__.py
3
+ brynq_sdk/newrelic/newrelic_interface.py
4
+ brynq_sdk_newrelic.egg-info/PKG-INFO
5
+ brynq_sdk_newrelic.egg-info/SOURCES.txt
6
+ brynq_sdk_newrelic.egg-info/dependency_links.txt
7
+ brynq_sdk_newrelic.egg-info/not-zip-safe
8
+ brynq_sdk_newrelic.egg-info/requires.txt
9
+ brynq_sdk_newrelic.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ brynq-sdk-brynq>=1
2
+ pandas<3,>=2
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,17 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name='brynq_sdk_newrelic',
5
+ version='1.0.0',
6
+ description='Newrelic wrapper from BrynQ',
7
+ long_description='Newrelic wrapper from BrynQ',
8
+ author='BrynQ',
9
+ author_email='support@brynq.com',
10
+ packages=["brynq_sdk.newrelic"],
11
+ license='BrynQ License',
12
+ install_requires=[
13
+ 'brynq-sdk-brynq>=1',
14
+ 'pandas>=2,<3'
15
+ ],
16
+ zip_safe=False,
17
+ )