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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq_sdk_newrelic
3
- Version: 1.0.2
3
+ Version: 2.0.0
4
4
  Summary: Newrelic wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -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, label: Union[str, List], debug: bool = False):
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(label)
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, label):
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.get_system_credential(system='newrelic-api', label=label)
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-newrelic
3
- Version: 1.0.2
3
+ Version: 2.0.0
4
4
  Summary: Newrelic wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -0,0 +1,2 @@
1
+ brynq-sdk-brynq<5,>=4
2
+ pandas<3,>=2
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_newrelic',
5
- version='1.0.2',
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>=2',
13
+ 'brynq-sdk-brynq>=4,<5',
14
14
  'pandas>=2,<3'
15
15
  ],
16
16
  zip_safe=False,
@@ -1,2 +0,0 @@
1
- brynq-sdk-brynq>=2
2
- pandas<3,>=2