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.
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/PKG-INFO +1 -1
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho/extract_zoho_desk.py +7 -8
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho/upload_zoho_desk.py +7 -10
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho.egg-info/PKG-INFO +1 -1
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/setup.py +1 -1
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho/__init__.py +0 -0
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho.egg-info/not-zip-safe +0 -0
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho.egg-info/requires.txt +0 -0
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/brynq_sdk_zoho.egg-info/top_level.txt +0 -0
- {brynq_sdk_zoho-2.0.4 → brynq_sdk_zoho-3.0.0}/setup.cfg +0 -0
|
@@ -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,
|
|
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(
|
|
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,
|
|
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.
|
|
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 {
|
|
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,
|
|
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(
|
|
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,
|
|
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.
|
|
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 {
|
|
33
|
+
'Authorization': f'Zoho-oauthtoken {credentials.get("access_token")}',
|
|
37
34
|
'Content-Type': 'application/json'
|
|
38
35
|
}
|
|
39
36
|
return headers
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|