brynq-sdk-newrelic 1.0.2__tar.gz → 2.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.
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/PKG-INFO +1 -1
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic/newrelic_interface.py +8 -6
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/PKG-INFO +1 -1
- brynq_sdk_newrelic-2.0.0/brynq_sdk_newrelic.egg-info/requires.txt +2 -0
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/setup.py +2 -2
- brynq_sdk_newrelic-1.0.2/brynq_sdk_newrelic.egg-info/requires.txt +0 -2
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic/__init__.py +0 -0
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/not-zip-safe +0 -0
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/top_level.txt +0 -0
- {brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/setup.cfg +0 -0
{brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic/newrelic_interface.py
RENAMED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
from brynq_sdk_brynq import BrynQ
|
|
2
|
-
from typing import Union, List
|
|
2
|
+
from typing import Union, List, Literal, Optional
|
|
3
3
|
import requests
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class NewRelicAPI(BrynQ):
|
|
7
7
|
|
|
8
|
-
def __init__(self,
|
|
8
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug: bool = False):
|
|
9
9
|
"""
|
|
10
10
|
For the full documentation, see: https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/
|
|
11
11
|
"""
|
|
12
12
|
super().__init__()
|
|
13
|
-
self.headers = self._set_credentials(
|
|
13
|
+
self.headers = self._set_credentials(system_type)
|
|
14
14
|
self.url = "https://api.newrelic.com/graphql"
|
|
15
|
+
self.timeout = 3600
|
|
15
16
|
|
|
16
|
-
def _set_credentials(self,
|
|
17
|
+
def _set_credentials(self, system_type):
|
|
17
18
|
"""
|
|
18
19
|
Get the credentials from BrynQ and get the username and private key from there
|
|
19
20
|
"""
|
|
20
|
-
credentials = self.
|
|
21
|
+
credentials = self.interfaces.credentials.get(system="newrelic-api", system_type=system_type)
|
|
22
|
+
credentials = credentials.get('data')
|
|
21
23
|
api_key = credentials['api_key']
|
|
22
24
|
headers = {
|
|
23
25
|
'API-Key': f'{api_key}',
|
|
@@ -26,7 +28,7 @@ class NewRelicAPI(BrynQ):
|
|
|
26
28
|
return headers
|
|
27
29
|
|
|
28
30
|
def execute_query(self, query: dict):
|
|
29
|
-
response = requests.post(self.url, headers=self.headers, json=query)
|
|
31
|
+
response = requests.post(self.url, headers=self.headers, json=query, timeout=self.timeout)
|
|
30
32
|
if response.status_code == 200:
|
|
31
33
|
return response.json()
|
|
32
34
|
else:
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='brynq_sdk_newrelic',
|
|
5
|
-
version='
|
|
5
|
+
version='2.0.0',
|
|
6
6
|
description='Newrelic wrapper from BrynQ',
|
|
7
7
|
long_description='Newrelic wrapper from BrynQ',
|
|
8
8
|
author='BrynQ',
|
|
@@ -10,7 +10,7 @@ setup(
|
|
|
10
10
|
packages=find_namespace_packages(include=['brynq_sdk*']),
|
|
11
11
|
license='BrynQ License',
|
|
12
12
|
install_requires=[
|
|
13
|
-
'brynq-sdk-brynq>=
|
|
13
|
+
'brynq-sdk-brynq>=4,<5',
|
|
14
14
|
'pandas>=2,<3'
|
|
15
15
|
],
|
|
16
16
|
zip_safe=False,
|
|
File without changes
|
{brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{brynq_sdk_newrelic-1.0.2 → brynq_sdk_newrelic-2.0.0}/brynq_sdk_newrelic.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|