cjapy 0.2.2.post1__tar.gz → 0.2.2.post3__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.
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/PKG-INFO +1 -1
- cjapy-0.2.2.post3/cjapy/__version__.py +1 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/cjapy.py +42 -6
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/projects.py +5 -1
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy.egg-info/PKG-INFO +1 -1
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/authenticating_without_config_json.md +3 -9
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/main.md +13 -5
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/releases.md +3 -0
- cjapy-0.2.2.post1/cjapy/__version__.py +0 -1
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/LICENSE +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/README.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/__init__.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/config.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/configs.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/connector.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/requestCreator.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/token_provider.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy/workspace.py +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy.egg-info/SOURCES.txt +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy.egg-info/dependency_links.txt +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy.egg-info/requires.txt +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/cjapy.egg-info/top_level.txt +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/cja.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/getting_started.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/logging.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/projects.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/requestCreator.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/docs/workspace.md +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/pyproject.toml +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/requirements.txt +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/setup.cfg +0 -0
- {cjapy-0.2.2.post1 → cjapy-0.2.2.post3}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.2-3"
|
|
@@ -245,7 +245,7 @@ class CJA:
|
|
|
245
245
|
"""
|
|
246
246
|
if calcId is None:
|
|
247
247
|
raise ValueError("Require a calculated metrics")
|
|
248
|
-
if data is None or type(data)
|
|
248
|
+
if data is None or type(data) != dict:
|
|
249
249
|
raise ValueError("Require a dictionary to create the calculated metrics")
|
|
250
250
|
if self.loggingEnabled:
|
|
251
251
|
self.logger.debug(f"updateCalculatedMetrics start, id: {calcId}")
|
|
@@ -988,18 +988,54 @@ class CJA:
|
|
|
988
988
|
res = self.connector.postData(self.endpoint + path, data=data)
|
|
989
989
|
return res
|
|
990
990
|
|
|
991
|
-
def createDataView(self,
|
|
991
|
+
def createDataView(self,
|
|
992
|
+
data: Union[dict, IO] = None,
|
|
993
|
+
name:str=None,
|
|
994
|
+
connectionId:str=None,
|
|
995
|
+
description:str="power by cjapy",
|
|
996
|
+
timeZone:str="US/Mountain",
|
|
997
|
+
minuteInactivity:int=30,
|
|
998
|
+
**kwargs) -> dict:
|
|
992
999
|
"""
|
|
993
1000
|
Create and stores the given Data View in the db.
|
|
994
1001
|
Arguments:
|
|
995
1002
|
data : REQUIRED : The dictionary or json file that holds the definition for the dataview to be created.
|
|
1003
|
+
name : OPTIONAL : If you want to pass the name of the data View (and not pass the whole definition)
|
|
1004
|
+
connectionId : OPTIONAL : If you want to pass the connectionId of the data View (and not pass the whole definition)
|
|
1005
|
+
timezone : OPTIONAL : The timezone to use in the data View (see here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
|
1006
|
+
common timezone: US/Montain, US/Pacific, US/Michigan, US/Central, Europe/London, Europe/Paris, Asia/Tokyo, Australia/Sydney
|
|
1007
|
+
minuteInactivity : OPTIONAL : number of minutes of inactivity before closing a session
|
|
996
1008
|
"""
|
|
997
1009
|
path = "/datagroups/dataviews/"
|
|
998
|
-
if data is None:
|
|
1010
|
+
if data is None and name is None and connectionId is None:
|
|
999
1011
|
raise ValueError("Require information to be passed for data view creation")
|
|
1000
|
-
if
|
|
1001
|
-
|
|
1002
|
-
data =
|
|
1012
|
+
if data is not None:
|
|
1013
|
+
if ".json" in data:
|
|
1014
|
+
with open(data, "r", encoding=kwargs.get("encoding", "utf-8")) as f:
|
|
1015
|
+
data = json.load(f)
|
|
1016
|
+
data = data
|
|
1017
|
+
if data is None and name is not None and connectionId is not None:
|
|
1018
|
+
data = {
|
|
1019
|
+
"name": name,
|
|
1020
|
+
"description": description,
|
|
1021
|
+
"parentDataGroupId": connectionId,
|
|
1022
|
+
"timezoneDesignator": timeZone,
|
|
1023
|
+
"sessionDefinition": [
|
|
1024
|
+
{
|
|
1025
|
+
"numPeriods": minuteInactivity,
|
|
1026
|
+
"granularity": "MINUTE",
|
|
1027
|
+
"func": "INACTIVITY",
|
|
1028
|
+
"events": [
|
|
1029
|
+
"string"
|
|
1030
|
+
]
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"organization": self.connector.config['org_id'],
|
|
1034
|
+
"externalData": {
|
|
1035
|
+
"externalParentId": connectionId
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
}
|
|
1003
1039
|
if self.loggingEnabled:
|
|
1004
1040
|
self.logger.debug(f"createDataView start")
|
|
1005
1041
|
res = self.connector.postData(self.endpoint + path, data=data, **kwargs)
|
|
@@ -27,6 +27,8 @@ class Project:
|
|
|
27
27
|
self.template: bool = projectDict.get("companyTemplate", False)
|
|
28
28
|
self.type: str = projectDict.get('type',None)
|
|
29
29
|
self.version: str = None
|
|
30
|
+
self.curation: bool = False
|
|
31
|
+
self.reportType:str = None
|
|
30
32
|
if "definition" in projectDict.keys() and projectDict.get('type') == "project":
|
|
31
33
|
definition: dict = projectDict["definition"]
|
|
32
34
|
self.version: str = definition.get("version", None)
|
|
@@ -51,6 +53,7 @@ class Project:
|
|
|
51
53
|
)
|
|
52
54
|
else:
|
|
53
55
|
self.reportType = "mobile"
|
|
56
|
+
self.version: str = projectDict.get("definition",{}).get("version", None)
|
|
54
57
|
elif "definition" in projectDict.keys() and projectDict.get('type') == "guidedAnalysis":
|
|
55
58
|
self.reportType = "guidedAnalysis"
|
|
56
59
|
definition: dict = projectDict["definition"]
|
|
@@ -74,7 +77,8 @@ class Project:
|
|
|
74
77
|
+ len(self.elementsUsed["filters"])
|
|
75
78
|
+ len(self.elementsUsed["calculatedMetrics"])
|
|
76
79
|
)
|
|
77
|
-
|
|
80
|
+
else:
|
|
81
|
+
self.reportType = projectDict.get('type','unknown')
|
|
78
82
|
def __str__(self) -> str:
|
|
79
83
|
return json.dumps(self.to_dict(), indent=4)
|
|
80
84
|
|
|
@@ -35,31 +35,25 @@ import os
|
|
|
35
35
|
|
|
36
36
|
USER = os.getenv('API_USER')
|
|
37
37
|
PASSWORD = os.environ.get('API_PASSWORD')
|
|
38
|
+
...
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
## 3. using the configure method
|
|
41
42
|
|
|
42
43
|
The `cjapy` module provide a configure method that will set the correct value to be used in the module.
|
|
43
44
|
|
|
44
|
-
**Note** : Be careful there is a possibility to pass the `path_to_key` or `private_key` to the configure method.\
|
|
45
|
-
Select the correct method:
|
|
46
|
-
|
|
47
|
-
* path_to_key : the element is a path to a file containing your key.
|
|
48
|
-
* private_key : the element is the key as a string directly.
|
|
49
|
-
|
|
50
45
|
```python
|
|
51
46
|
import os
|
|
52
47
|
|
|
53
48
|
my_org_id = os.getenv('org_id')
|
|
54
49
|
my_tech_id = os.environ.get('tech_id')
|
|
55
50
|
my_secret = os.environ.get('secret')
|
|
56
|
-
my_path_to_key = os.environ.get('path_to_key')
|
|
57
51
|
my_client_id = os.environ.get('client_id')
|
|
58
|
-
|
|
52
|
+
my_scopes = os.environ.get('scopes')
|
|
59
53
|
|
|
60
54
|
import cjapy
|
|
61
55
|
|
|
62
|
-
cjapy.configure(org_id=my_org_id,tech_id=my_tech_id, secret=my_secret,
|
|
56
|
+
cjapy.configure(org_id=my_org_id,tech_id=my_tech_id, secret=my_secret,client_id=my_client_id,scopes=my_scopes)
|
|
63
57
|
|
|
64
58
|
```
|
|
65
59
|
|
|
@@ -13,14 +13,18 @@ The methods available directly from the module are the following:
|
|
|
13
13
|
### createConfigFile
|
|
14
14
|
|
|
15
15
|
This methods allows you to create JSON file that will host the different information required for your connection to Adobe IO and to retrieve the token.\
|
|
16
|
-
It
|
|
16
|
+
It has 2 possible parameters:
|
|
17
|
+
* filename : OPTIONAL : If you want to create your config file from a specific name
|
|
18
|
+
* auth_type : OPTIONAL : By default using OauthV2 (Server-to-Server) but can be changed to `jwt`. JWT will be discontinue in 2025.
|
|
19
|
+
|
|
20
|
+
It usually looks like this.
|
|
17
21
|
|
|
18
22
|
```python
|
|
19
23
|
import aanalytics2 as api2
|
|
20
24
|
api2.createConfigFile()
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
As you can see, it
|
|
27
|
+
As you can see, it no arguments are required and the output of the file will look like this :
|
|
24
28
|
|
|
25
29
|
```JavaScript
|
|
26
30
|
{
|
|
@@ -28,12 +32,13 @@ As you can see, it takes no argument and the output of the file will look like t
|
|
|
28
32
|
'client_id': "<clientId>",
|
|
29
33
|
'tech_id': "<something>@techacct.adobe.com",
|
|
30
34
|
'secret': "<YourSecret>",
|
|
31
|
-
'
|
|
35
|
+
'scopes': '<scopesServerToServer>',
|
|
32
36
|
}
|
|
33
37
|
```
|
|
34
38
|
|
|
35
39
|
You update the information from the Adobe IO account that you have setup.
|
|
36
40
|
|
|
41
|
+
|
|
37
42
|
### importConfigFile
|
|
38
43
|
|
|
39
44
|
As you have created your JSON config file, you will need to import it before realizing any request to the Analytics API.\
|
|
@@ -63,8 +68,11 @@ The different arguments are:
|
|
|
63
68
|
* tech_id : REQUIRED : Technical Account ID
|
|
64
69
|
* secret : REQUIRED : secret generated for your connection
|
|
65
70
|
* client_id : REQUIRED : The client_id (old api_key) provided by the JWT connection.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
71
|
+
* scopes : REQUIRED : Require if using the oauth Server to Server
|
|
72
|
+
* path_to_key : REQUIRED : If you have a file containing your private key value. If using jwt.
|
|
73
|
+
* private_key : REQUIRED : If you do not use a file but pass a variable directly. If using jwt.
|
|
74
|
+
|
|
75
|
+
**Note**: JWT integration will be discontinue in 2025. Hence we do not recommend starting a new integration using the `path_to_key` and `private_key` parameters.
|
|
68
76
|
|
|
69
77
|
### CJA class
|
|
70
78
|
|
|
@@ -10,6 +10,9 @@ The changes have been tracked starting version 0.1.0
|
|
|
10
10
|
Patch:
|
|
11
11
|
* Changing Oauth V2 to V3
|
|
12
12
|
* Accepting more elements as credentials
|
|
13
|
+
* Fixing some edge cases of `findComponentUsage`
|
|
14
|
+
* Adding more parameters for `createDataView` methods
|
|
15
|
+
* Fixing `updateCalculatedMetric`
|
|
13
16
|
|
|
14
17
|
## 0.2.1
|
|
15
18
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.2-1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|