brynq-sdk-zoho 2.0.4__tar.gz → 3.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_zoho
3
- Version: 2.0.4
3
+ Version: 3.0.0
4
4
  Summary: ZOHO wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import sys
3
3
  import pandas as pd
4
- from typing import Union, List
4
+ from typing import Union, List, Optional, Literal
5
5
  import requests
6
6
  import json
7
7
  from brynq_sdk_brynq import BrynQ
@@ -12,29 +12,28 @@ sys.path.append(basedir)
12
12
 
13
13
  class ExtractZohoDesk(BrynQ):
14
14
 
15
- def __init__(self, label: Union[str, List], debug: bool = False):
15
+ def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug: bool = False):
16
16
  """
17
17
  For the full documentation, see: https://avisi-apps.gitbook.io/tracket/api/
18
18
  """
19
19
  super().__init__()
20
- self.headers = self._get_authentication(label=label)
20
+ self.headers = self._get_authentication(system_type)
21
21
  self.base_url = "https://desk.zoho.com/api/v1/"
22
22
  self.payload = {}
23
23
  self.timeout = 3600
24
24
 
25
- def _get_authentication(self, label):
25
+ def _get_authentication(self, system_type):
26
26
  """
27
27
  Get the credentials for the Tracket API from BrynQ, with those credentials, get the access_token for Tracket.
28
28
  Return the headers with the access_token.
29
29
  """
30
30
  # Get credentials from BrynQ
31
- credentials = self.get_system_credential(system='zoho-desk', label=label)
31
+ credentials = self.interfaces.credentials.get(system="zoho-desk", system_type=system_type)
32
+ credentials = credentials.get('data')
32
33
 
33
34
  # With those credentials, get the access_token from Tracket
34
- zoho_system_id = credentials["id"]
35
- token = BrynQ().refresh_system_credential(system="zoho-desk", system_id=zoho_system_id)["access_token"]
36
35
  headers = {
37
- 'Authorization': f'Zoho-oauthtoken {token}'
36
+ 'Authorization': f'Zoho-oauthtoken {credentials.get("access_token")}'
38
37
  }
39
38
  return headers
40
39
 
@@ -1,39 +1,36 @@
1
1
  import os
2
2
  import sys
3
3
  import pandas as pd
4
- from typing import Union, List
4
+ from typing import Union, List, Optional, Literal
5
5
  import requests
6
6
  import json
7
7
  from brynq_sdk_brynq import BrynQ
8
-
9
8
  basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10
9
  sys.path.append(basedir)
11
10
 
12
11
 
13
12
  class UploadZohoDesk(BrynQ):
14
13
 
15
- def __init__(self, label: Union[str, List], debug: bool = False):
14
+ def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug: bool = False):
16
15
  """
17
16
  For the full documentation, see: https://avisi-apps.gitbook.io/tracket/api/
18
17
  """
19
18
  super().__init__()
20
- self.headers = self._get_authentication(label=label)
19
+ self.headers = self._get_authentication(system_type)
21
20
  self.base_url = "https://desk.zoho.com/api/v1/"
22
21
  self.timeout = 3600
23
22
 
24
- def _get_authentication(self, label):
23
+ def _get_authentication(self, system_type):
25
24
  """
26
25
  Get the credentials for the Traket API from BrynQ, with those credentials, get the access_token for Tracket.
27
26
  Return the headers with the access_token.
28
27
  """
29
28
  # Get credentials from BrynQ
30
- credentials = self.get_system_credential(system='zoho-desk', label=label)
29
+ credentials = self.interfaces.credentials.get(system="zoho-desk", system_type=system_type)
30
+ credentials = credentials.get('data')
31
31
 
32
- # With those credentials, get the access_token from Tracket
33
- zoho_system_id = credentials["id"]
34
- token = BrynQ().refresh_system_credential(system="zoho-desk", system_id=zoho_system_id)["access_token"]
35
32
  headers = {
36
- 'Authorization': f'Zoho-oauthtoken {token}',
33
+ 'Authorization': f'Zoho-oauthtoken {credentials.get("access_token")}',
37
34
  'Content-Type': 'application/json'
38
35
  }
39
36
  return headers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-zoho
3
- Version: 2.0.4
3
+ Version: 3.0.0
4
4
  Summary: ZOHO wrapper from BrynQ
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_zoho',
5
- version='2.0.4',
5
+ version='3.0.0',
6
6
  description='ZOHO wrapper from BrynQ',
7
7
  long_description='ZOHO wrapper from BrynQ',
8
8
  author='BrynQ',
File without changes