berryworld 1.0.0.189012__py3-none-any.whl → 1.0.0.189413__py3-none-any.whl
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.
- berryworld/power_automate.py +44 -17
- {berryworld-1.0.0.189012.dist-info → berryworld-1.0.0.189413.dist-info}/METADATA +1 -1
- {berryworld-1.0.0.189012.dist-info → berryworld-1.0.0.189413.dist-info}/RECORD +6 -6
- {berryworld-1.0.0.189012.dist-info → berryworld-1.0.0.189413.dist-info}/WHEEL +1 -1
- {berryworld-1.0.0.189012.dist-info → berryworld-1.0.0.189413.dist-info}/licenses/LICENSE +0 -0
- {berryworld-1.0.0.189012.dist-info → berryworld-1.0.0.189413.dist-info}/top_level.txt +0 -0
berryworld/power_automate.py
CHANGED
|
@@ -158,11 +158,16 @@ class PowerAutomate:
|
|
|
158
158
|
f'owners?{self.api_version}'
|
|
159
159
|
|
|
160
160
|
flow_owners_response = self.session_request("GET", flow_url).to_dict(orient='records')
|
|
161
|
-
flow_user_ids = [
|
|
162
|
-
|
|
161
|
+
flow_user_ids = []
|
|
162
|
+
flow_group_ids = []
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
for owner in flow_owners_response:
|
|
165
|
+
if 'principal' in owner['properties']:
|
|
166
|
+
principal_type = owner['properties']['principal'].get('type', None)
|
|
167
|
+
if principal_type == 'User':
|
|
168
|
+
flow_user_ids.append(owner['name'])
|
|
169
|
+
elif principal_type == 'Group':
|
|
170
|
+
flow_group_ids.append(owner['name'])
|
|
166
171
|
|
|
167
172
|
return flow_user_ids, flow_group_ids
|
|
168
173
|
|
|
@@ -171,17 +176,36 @@ class PowerAutomate:
|
|
|
171
176
|
:param account_type: Type of account to get the information from
|
|
172
177
|
:param account_ids: IDs of the accounts to get the information from
|
|
173
178
|
"""
|
|
174
|
-
graph_url = f'https://graph.microsoft.com/v1.0/{account_type.lower()}?$top=999'
|
|
175
|
-
|
|
176
179
|
accounts_df = pd.DataFrame()
|
|
177
|
-
if graph_url is not None:
|
|
178
|
-
if account_ids is not None:
|
|
179
|
-
graph_url = graph_url + '&$filter=' + ' or '.join([f'id eq \'{user_id}\'' for user_id in account_ids])
|
|
180
180
|
|
|
181
|
+
if account_ids is not None:
|
|
181
182
|
headers = self.generate_bearer_token(grant_type='client_credentials',
|
|
182
183
|
scope='https://graph.microsoft.com/.default')
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
remaining_ids = [user_id for user_id in account_ids if user_id]
|
|
186
|
+
|
|
187
|
+
while remaining_ids:
|
|
188
|
+
graph_url = f'https://graph.microsoft.com/v1.0/{account_type.lower()}?$top=999'
|
|
189
|
+
graph_url += '&$filter=' + ' or '.join([f"id eq '{user_id}'" for user_id in remaining_ids])
|
|
190
|
+
|
|
191
|
+
try:
|
|
192
|
+
result = self.session_request("GET", graph_url, headers=headers)
|
|
193
|
+
if isinstance(result, pd.DataFrame):
|
|
194
|
+
accounts_df = pd.concat([accounts_df, result], ignore_index=True)
|
|
195
|
+
else:
|
|
196
|
+
accounts_df = pd.concat([accounts_df, pd.DataFrame(result)], ignore_index=True)
|
|
197
|
+
break
|
|
198
|
+
except Exception as e:
|
|
199
|
+
error_message = str(e)
|
|
200
|
+
if '404' in error_message and 'Request_ResourceNotFound' in error_message and len(remaining_ids) > 1:
|
|
201
|
+
for user_id in remaining_ids.copy():
|
|
202
|
+
try:
|
|
203
|
+
single_url = f"https://graph.microsoft.com/v1.0/{account_type.lower()}?$filter=id eq '{user_id}'"
|
|
204
|
+
self.session_request("GET", single_url, headers=headers)
|
|
205
|
+
except Exception as error_message1:
|
|
206
|
+
if '404' in str(error_message1) and 'Request_ResourceNotFound' in error_message1:
|
|
207
|
+
remaining_ids.remove(user_id)
|
|
208
|
+
break
|
|
185
209
|
|
|
186
210
|
return accounts_df
|
|
187
211
|
|
|
@@ -219,7 +243,8 @@ class PowerAutomate:
|
|
|
219
243
|
accounts_df = pd.concat([accounts_df, self.list_graph_accounts('groups', batch_group_ids)])
|
|
220
244
|
|
|
221
245
|
# Get Creator
|
|
222
|
-
flows_df['CreatedById'] = flows_df['FlowProperties'].apply(
|
|
246
|
+
flows_df['CreatedById'] = flows_df['FlowProperties'].apply(
|
|
247
|
+
lambda x: x['creator']['userId'] if 'creator' in x else None)
|
|
223
248
|
flows_df = flows_df.merge(
|
|
224
249
|
accounts_df[['displayName', 'id']].rename(columns={'id': 'CreatedById'}).drop_duplicates(),
|
|
225
250
|
how='left', on='CreatedById')
|
|
@@ -467,12 +492,14 @@ class PowerAutomate:
|
|
|
467
492
|
)
|
|
468
493
|
|
|
469
494
|
if relevant_columns & enrich:
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
495
|
+
required_columns = ['FlowId', 'FlowName', 'id', 'FlowUrl', 'JsonDefinition', 'State', 'CreatedBy',
|
|
496
|
+
'Owners', 'CreatedDate', 'LastModifiedDate', 'FlowSuspensionReason',
|
|
497
|
+
'ErrorCount', 'ErrorMessage', 'RunCount', 'RunProperties', 'LastRun',
|
|
498
|
+
'LastRunStatus', 'ConnectionAccountName', 'ConnectionStatus',
|
|
499
|
+
'ConnectionLastModifiedTime', 'ConnectionsCount', 'ConnectionAuthenticatedUserName']
|
|
500
|
+
|
|
501
|
+
existing_columns = [col for col in required_columns if col in flows_df.columns]
|
|
502
|
+
flows_final_df = flows_df[existing_columns]
|
|
476
503
|
|
|
477
504
|
if 'FlowSuspensionReasonDetails' in flows_df.columns:
|
|
478
505
|
flows_final_df = flows_final_df.assign(
|
|
@@ -15,7 +15,7 @@ berryworld/logic_apps.py,sha256=a0uU4tNO3v2w7grdBv-OOx4hUf7VBIerJpwZ9U-29dQ,1459
|
|
|
15
15
|
berryworld/microsoft_teams.py,sha256=8uPo0yku-euBj2VdzBoZCeX3IcsCCOqISLqaVZUVxfA,16030
|
|
16
16
|
berryworld/persistent_storage.py,sha256=KQA57ez8eVTUCtudYkHPg_S5lcOEa_E7xXcaN1DYMMc,8601
|
|
17
17
|
berryworld/pickle_management.py,sha256=5o6UuXBpTj23Jgpz6sj9V-vdcdWBK1xMEckWxT-Whj4,2436
|
|
18
|
-
berryworld/power_automate.py,sha256=
|
|
18
|
+
berryworld/power_automate.py,sha256=V86QEGG9H36DrDvod9Q6yp8OUu307hfYcXJhw06pYrA,27912
|
|
19
19
|
berryworld/sharepoint_con.py,sha256=TuH-Vxk1VxjTi7x80KFssf_J8YPLRXpV27RBaFZi37U,22254
|
|
20
20
|
berryworld/snowflake_conn.py,sha256=go5ZJjnhz5SkG83B0G0XZSwKgU6tg7AFTBso59oRG5M,2434
|
|
21
21
|
berryworld/sql_conn.py,sha256=r2rAVRc3Mes0m6_62J4uFg5GLBNMr7Vkme9Ip6jT3aA,47283
|
|
@@ -25,12 +25,12 @@ berryworld/verify_keys.py,sha256=X4Nuz3o0XbRDYofbJGvxIDeN5gfWj19PN7lhO6T3hR8,435
|
|
|
25
25
|
berryworld/vivantio.py,sha256=QfZo0UKqkzVRg_LyiwivNd3aEup4TH57x4KxLZkCJwc,10627
|
|
26
26
|
berryworld/vivantio_logging.py,sha256=ciy7gA4u3FrgUIpEBnMgocbNPp6jcu9TPoy-kLcrTZU,5736
|
|
27
27
|
berryworld/xml_parser.py,sha256=HWD71NaTN3DaIOGT6Wzxs4CEsroFhGQwe9iPLIL80Co,957
|
|
28
|
-
berryworld-1.0.0.
|
|
28
|
+
berryworld-1.0.0.189413.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
|
|
29
29
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
|
|
31
31
|
tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
|
|
32
32
|
tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
|
|
33
|
-
berryworld-1.0.0.
|
|
34
|
-
berryworld-1.0.0.
|
|
35
|
-
berryworld-1.0.0.
|
|
36
|
-
berryworld-1.0.0.
|
|
33
|
+
berryworld-1.0.0.189413.dist-info/METADATA,sha256=Ax85B6zJC5_Ge49j02LHE3xfFvvGVZG7BnumShjq7e8,1362
|
|
34
|
+
berryworld-1.0.0.189413.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
35
|
+
berryworld-1.0.0.189413.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
|
|
36
|
+
berryworld-1.0.0.189413.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|