brynq-sdk-monday 1.1.5__tar.gz → 1.2.1__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_monday-1.1.5 → brynq_sdk_monday-1.2.1}/PKG-INFO +1 -1
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday/extract_monday.py +80 -2
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/PKG-INFO +1 -1
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/setup.py +1 -1
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday/__init__.py +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday/extract_tracket.py +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday/upload_tracket.py +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/not-zip-safe +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/requires.txt +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/top_level.txt +0 -0
- {brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/setup.cfg +0 -0
|
@@ -32,7 +32,7 @@ class ExtractMonday(BrynQ):
|
|
|
32
32
|
|
|
33
33
|
return headers
|
|
34
34
|
|
|
35
|
-
def
|
|
35
|
+
def get_activity_logs_boards(self, board_id: int, start_date: str, end_date: str, column_ids: str = '', limit: int = 25):
|
|
36
36
|
"""
|
|
37
37
|
See for the docs: https://developer.monday.com/api-reference/docs/activity-logs
|
|
38
38
|
:param board_id: the ID of the board you want to get the activity logs from
|
|
@@ -63,6 +63,85 @@ class ExtractMonday(BrynQ):
|
|
|
63
63
|
continue_loop = False
|
|
64
64
|
return df
|
|
65
65
|
|
|
66
|
+
|
|
67
|
+
def get_activity_logs_items(
|
|
68
|
+
self,
|
|
69
|
+
board_id: int,
|
|
70
|
+
item_ids: list,
|
|
71
|
+
start_date: str,
|
|
72
|
+
end_date: str = None,
|
|
73
|
+
limit: int = 500,
|
|
74
|
+
):
|
|
75
|
+
"""
|
|
76
|
+
Retrieve activity‑log history for one or more items on a monday.com board.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
board_id : int
|
|
81
|
+
ID of the board that owns the items.
|
|
82
|
+
item_ids : list
|
|
83
|
+
List of item IDs (max 50 per request, per monday API limits).
|
|
84
|
+
start_date : str
|
|
85
|
+
Lower‑bound timestamp in ISO‑8601 format (``YYYY‑MM‑DDThh:mm:ssZ``).
|
|
86
|
+
end_date : str, optional
|
|
87
|
+
Upper‑bound timestamp in ISO‑8601 format. ``None`` means "up to now".
|
|
88
|
+
limit : int, optional
|
|
89
|
+
Maximum log rows per page (default 500, monday hard‑caps at 500).
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
pandas.DataFrame
|
|
94
|
+
DataFrame containing the activity‑log rows.
|
|
95
|
+
"""
|
|
96
|
+
continue_loop = True
|
|
97
|
+
page = 0
|
|
98
|
+
df = pd.DataFrame()
|
|
99
|
+
|
|
100
|
+
# Pre‑format the item‑ID literal once
|
|
101
|
+
ids_literal = ",".join(str(i) for i in item_ids)
|
|
102
|
+
|
|
103
|
+
while continue_loop:
|
|
104
|
+
page += 1
|
|
105
|
+
to_clause = f'to: "{end_date}", ' if end_date else ''
|
|
106
|
+
query = (
|
|
107
|
+
f'query {{ boards (ids: {board_id}) {{ '
|
|
108
|
+
f'activity_logs (item_ids: [{ids_literal}], '
|
|
109
|
+
f'from: "{start_date}", '
|
|
110
|
+
+ to_clause +
|
|
111
|
+
f'limit: {limit}, page: {page}) '
|
|
112
|
+
f'{{ id event entity data user_id created_at }} }} }}'
|
|
113
|
+
)
|
|
114
|
+
payload = json.dumps({"query": query})
|
|
115
|
+
|
|
116
|
+
if self.debug:
|
|
117
|
+
print(payload)
|
|
118
|
+
|
|
119
|
+
response = requests.request("POST", self.endpoint, headers=self.headers, data=payload)
|
|
120
|
+
|
|
121
|
+
if self.debug:
|
|
122
|
+
print(response.json())
|
|
123
|
+
|
|
124
|
+
response.raise_for_status()
|
|
125
|
+
|
|
126
|
+
logs = response.json()["data"]["boards"][0]["activity_logs"]
|
|
127
|
+
|
|
128
|
+
# Append to dataframe if we received rows
|
|
129
|
+
if logs:
|
|
130
|
+
df = pd.concat([df, pd.json_normalize(logs)], axis=0)
|
|
131
|
+
|
|
132
|
+
# Stop looping once the page returns fewer rows than the page size
|
|
133
|
+
if len(logs) < limit:
|
|
134
|
+
continue_loop = False
|
|
135
|
+
|
|
136
|
+
# -- flatten the JSON held in the "data" column into real columns
|
|
137
|
+
if not df.empty and "data" in df.columns:
|
|
138
|
+
# convert JSON‑encoded strings into dicts
|
|
139
|
+
data_dicts = df["data"].apply(lambda x: json.loads(x) if isinstance(x, str) and x.startswith("{") else {})
|
|
140
|
+
df_expanded = pd.json_normalize(data_dicts, sep="__")
|
|
141
|
+
df = pd.concat([df.drop(columns=["data"]).reset_index(drop=True), df_expanded.reset_index(drop=True)], axis=1)
|
|
142
|
+
|
|
143
|
+
return df
|
|
144
|
+
|
|
66
145
|
def get_users(self, limit: int = 50, fields: str = 'id name created_at email is_admin is_guest is_view_only is_pending enabled join_date title last_activity account {id}'):
|
|
67
146
|
continue_loop = True
|
|
68
147
|
page = 0
|
|
@@ -248,4 +327,3 @@ class ExtractMonday(BrynQ):
|
|
|
248
327
|
continue_loop = False
|
|
249
328
|
|
|
250
329
|
return df
|
|
251
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_monday-1.1.5 → brynq_sdk_monday-1.2.1}/brynq_sdk_monday.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|