berryworld 1.0.0.189396__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.
@@ -176,17 +176,36 @@ class PowerAutomate:
176
176
  :param account_type: Type of account to get the information from
177
177
  :param account_ids: IDs of the accounts to get the information from
178
178
  """
179
- graph_url = f'https://graph.microsoft.com/v1.0/{account_type.lower()}?$top=999'
180
-
181
179
  accounts_df = pd.DataFrame()
182
- if graph_url is not None:
183
- if account_ids is not None:
184
- graph_url = graph_url + '&$filter=' + ' or '.join([f'id eq \'{user_id}\'' for user_id in account_ids])
185
180
 
181
+ if account_ids is not None:
186
182
  headers = self.generate_bearer_token(grant_type='client_credentials',
187
183
  scope='https://graph.microsoft.com/.default')
188
184
 
189
- accounts_df = self.session_request("GET", graph_url, headers=headers)
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
190
209
 
191
210
  return accounts_df
192
211
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: berryworld
3
- Version: 1.0.0.189396
3
+ Version: 1.0.0.189413
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -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=IWLXdc4-HPM0Eq9VwlaXcr17vQKh6LOmtqo-CztUzJY,26713
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.189396.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
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.189396.dist-info/METADATA,sha256=T8GbmSXFhWFhwvXBzh9W7XhduBes63nHmH_p5Bi4ZkI,1362
34
- berryworld-1.0.0.189396.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
35
- berryworld-1.0.0.189396.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
36
- berryworld-1.0.0.189396.dist-info/RECORD,,
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,,