berryworld 1.0.0.183171__py3-none-any.whl → 1.0.0.184575__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.
@@ -418,68 +418,85 @@ class PowerAutomate:
418
418
  except KeyError:
419
419
  raise KeyError('Please provide a value to enrich the response with')
420
420
 
421
- flow_url = f'{self.base_flow_url}/scopes/admin/environments/{self.environment_id}/flows?{self.api_version}'
421
+ flow_url = f'{self.base_flow_url}/scopes/admin/environments/{self.environment_id}/v2/flows?{self.api_version}'
422
422
  flows_df = self.session_request("GET", flow_url)
423
- flows_df.rename(columns={'name': 'FlowId', 'properties': 'FlowProperties'}, inplace=True)
424
-
425
- if enrich_owners:
426
- flows_df = self.enrich_owners(flows_df)
427
- flows_df.drop_duplicates(subset=['FlowId'], inplace=True)
428
-
429
- if enrich_info:
430
- flows_df = self.enrich_info(flows_df)
431
-
432
- if enrich_run_history:
433
- flows_df = self.enrich_run_history(flows_df)
434
-
435
- if enrich_connections:
436
- flows_df = self.enrich_connections(flows_df)
437
-
438
- if enrich_flow_url:
439
- flows_df = self.enrich_flow_url(flows_df)
440
-
441
- flows_df.rename(
442
- columns={
443
- 'displayName': 'FlowName', 'definition': 'JsonDefinition', 'state': 'State',
444
- 'createdTime': 'CreatedDate', 'lastModifiedTime': 'LastModifiedDate',
445
- 'flowSuspensionReason': 'FlowSuspensionReason', 'flowSuspensionTime': 'FlowSuspensionTime',
446
- 'flowSuspensionReasonDetails': 'FlowSuspensionReasonDetails',
447
- 'AuthenticatedUserName': 'ConnectionAuthenticatedUserName'
448
- }, inplace=True
449
- )
450
-
451
- if relevant_columns & enrich:
452
- flows_final_df = flows_df[['FlowId', 'FlowName', 'id', 'FlowUrl', 'JsonDefinition', 'State', 'CreatedBy',
453
- 'Owners', 'CreatedDate', 'LastModifiedDate', 'FlowSuspensionReason',
454
- 'ErrorCount', 'ErrorMessage', 'RunCount', 'RunProperties', 'LastRun',
455
- 'LastRunStatus', 'ConnectionAccountName', 'ConnectionStatus',
456
- 'ConnectionLastModifiedTime', 'ConnectionsCount',
457
- 'ConnectionAuthenticatedUserName']]
458
-
459
- if 'FlowSuspensionReasonDetails' in flows_df.columns:
460
- flows_final_df = flows_final_df.assign(
461
- **{'FlowSuspensionReasonDetails': flows_df['FlowSuspensionReasonDetails']})
462
- if 'FlowSuspensionTime' in flows_df.columns:
463
- flows_final_df = flows_final_df.assign(**{'FlowSuspensionTime': flows_df['FlowSuspensionTime']})
464
- if 'ConnectionErrorCode' in flows_df.columns:
465
- flows_final_df = flows_final_df.assign(**{'ConnectionErrorCode': flows_df['ConnectionErrorCode']})
466
- if 'ConnectionErrorMessage' in flows_df.columns:
467
- flows_final_df = flows_final_df.assign(**{'ConnectionErrorMessage': flows_df['ConnectionErrorMessage']})
468
- else:
469
- flows_final_df = flows_df
470
423
 
471
- if 'FlowName' in flows_final_df.columns:
472
- flows_final_df = flows_final_df.sort_values(by=['FlowName'])
424
+ # After first call, we use the IDs to get the flows properties from a separate call
425
+ flows_data = pd.DataFrame()
426
+ failed_flows_df = pd.DataFrame()
427
+ flows_final_df = pd.DataFrame()
428
+ if flows_df.shape[0] > 0 and 'name' in flows_df.columns:
429
+ for flow_id in flows_df['name']:
430
+ flow_url = f'{self.base_flow_url}/environments/{self.environment_id}/flows/{flow_id}?api-version=2016-11-01'
431
+ try:
432
+ flow_data = self.session_request("GET", flow_url)
433
+ flows_data = pd.concat([flows_data, flow_data], ignore_index=True)
434
+ except Exception as e:
435
+ failed_flow = flows_df[flows_df['name'] == flow_id].copy()
436
+ failed_flow['ErrorMessage'] = str(e)
437
+
438
+ failed_flows_df = pd.concat([failed_flows_df, failed_flow], ignore_index=True)
439
+
440
+ flows_data.rename(columns={'name': 'FlowId', 'properties': 'FlowProperties'}, inplace=True)
441
+ flows_df = flows_data.copy()
442
+
443
+ if enrich_owners:
444
+ flows_df = self.enrich_owners(flows_df)
445
+ flows_df.drop_duplicates(subset=['FlowId'], inplace=True)
446
+
447
+ if enrich_info:
448
+ flows_df = self.enrich_info(flows_df)
449
+
450
+ if enrich_run_history:
451
+ flows_df = self.enrich_run_history(flows_df)
452
+
453
+ if enrich_connections:
454
+ flows_df = self.enrich_connections(flows_df)
455
+
456
+ if enrich_flow_url:
457
+ flows_df = self.enrich_flow_url(flows_df)
458
+
459
+ flows_df.rename(
460
+ columns={
461
+ 'displayName': 'FlowName', 'definition': 'JsonDefinition', 'state': 'State',
462
+ 'createdTime': 'CreatedDate', 'lastModifiedTime': 'LastModifiedDate',
463
+ 'flowSuspensionReason': 'FlowSuspensionReason', 'flowSuspensionTime': 'FlowSuspensionTime',
464
+ 'flowSuspensionReasonDetails': 'FlowSuspensionReasonDetails',
465
+ 'AuthenticatedUserName': 'ConnectionAuthenticatedUserName'
466
+ }, inplace=True
467
+ )
468
+
469
+ if relevant_columns & enrich:
470
+ flows_final_df = flows_df[['FlowId', 'FlowName', 'id', 'FlowUrl', 'JsonDefinition', 'State', 'CreatedBy',
471
+ 'Owners', 'CreatedDate', 'LastModifiedDate', 'FlowSuspensionReason',
472
+ 'ErrorCount', 'ErrorMessage', 'RunCount', 'RunProperties', 'LastRun',
473
+ 'LastRunStatus', 'ConnectionAccountName', 'ConnectionStatus',
474
+ 'ConnectionLastModifiedTime', 'ConnectionsCount',
475
+ 'ConnectionAuthenticatedUserName']]
476
+
477
+ if 'FlowSuspensionReasonDetails' in flows_df.columns:
478
+ flows_final_df = flows_final_df.assign(
479
+ **{'FlowSuspensionReasonDetails': flows_df['FlowSuspensionReasonDetails']})
480
+ if 'FlowSuspensionTime' in flows_df.columns:
481
+ flows_final_df = flows_final_df.assign(**{'FlowSuspensionTime': flows_df['FlowSuspensionTime']})
482
+ if 'ConnectionErrorCode' in flows_df.columns:
483
+ flows_final_df = flows_final_df.assign(**{'ConnectionErrorCode': flows_df['ConnectionErrorCode']})
484
+ if 'ConnectionErrorMessage' in flows_df.columns:
485
+ flows_final_df = flows_final_df.assign(**{'ConnectionErrorMessage': flows_df['ConnectionErrorMessage']})
486
+ else:
487
+ flows_final_df = flows_df
488
+
489
+ if 'FlowName' in flows_final_df.columns:
490
+ flows_final_df = flows_final_df.sort_values(by=['FlowName'])
473
491
 
474
- return flows_final_df.reset_index(drop=True)
492
+ return flows_final_df.reset_index(drop=True), failed_flows_df
475
493
 
476
494
  def update_flow(self, flow_id, payload):
477
495
  """ Update a flow
478
496
  :param flow_id: ID of the flow to be updated
479
497
  :param payload: Payload to be sent to the API
480
498
  """
481
- flow_url = f'{self.base_flow_url}/scopes/admin/environments/{self.environment_id}/' \
482
- f'flows/{flow_id}?{self.api_version}'
499
+ flow_url = f'{self.base_flow_url}/environments/{self.environment_id}/flows/{flow_id}?{self.api_version}'
483
500
 
484
501
  # currently no support to patch flow owners, can only be done via flow UI or admin center (09/2023)
485
502
  if isinstance(payload, dict):
@@ -496,8 +513,7 @@ class PowerAutomate:
496
513
  """ Delete a flow
497
514
  :param flow_id: ID of the flow to be deleted
498
515
  """
499
- flow_url = f'{self.base_flow_url}/scopes/admin/environments/{self.environment_id}/' \
500
- f'flows/{flow_id}?{self.api_version}'
516
+ flow_url = f'{self.base_flow_url}/environments/{self.environment_id}/flows/{flow_id}?{self.api_version}'
501
517
 
502
518
  flow_delete_response = self.session.request("DELETE", flow_url, headers=self.headers)
503
519
 
berryworld/verify_keys.py CHANGED
@@ -14,9 +14,11 @@ load_dotenv(os.path.join(os.getcwd(), '.env'))
14
14
  class Verify:
15
15
  """ Encrypt and Verify keys """
16
16
 
17
- def __init__(self, key_name: str = 'SECRET_KEY'):
17
+ def __init__(self, key_name: str = 'SECRET_KEY', key_override: str = None):
18
18
  """ Initialize the class """
19
19
  self.key = os.environ.get(key_name)
20
+ if key_override is not None:
21
+ self.key = key_override
20
22
  self.iterations = 100_000
21
23
 
22
24
  def decrypt(self, token: str) -> str:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: berryworld
3
- Version: 1.0.0.183171
3
+ Version: 1.0.0.184575
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -22,13 +22,22 @@ Requires-Dist: pyodbc>=4.0.39
22
22
  Requires-Dist: python-dotenv>=1.0.0
23
23
  Requires-Dist: PyYAML>=6.0
24
24
  Requires-Dist: requests>=2.31.0
25
- Requires-Dist: scipy>=1.11.1
25
+ Requires-Dist: scipy>=1.14.1
26
26
  Requires-Dist: setuptools>=61.2.0
27
27
  Requires-Dist: SQLAlchemy>=1.4.32
28
28
  Requires-Dist: snowflake-connector-python>=3.12.2
29
29
  Requires-Dist: snowflake>=0.12.1
30
30
  Requires-Dist: cffi>=1.15.1
31
31
  Requires-Dist: beautifulsoup4>=4.12.2
32
+ Dynamic: author
33
+ Dynamic: author-email
34
+ Dynamic: classifier
35
+ Dynamic: description
36
+ Dynamic: description-content-type
37
+ Dynamic: home-page
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
32
41
 
33
42
  # BerryWorld
34
43
 
@@ -16,13 +16,13 @@ berryworld/microsoft_teams.py,sha256=8uPo0yku-euBj2VdzBoZCeX3IcsCCOqISLqaVZUVxfA
16
16
  berryworld/persistent_storage.py,sha256=KQA57ez8eVTUCtudYkHPg_S5lcOEa_E7xXcaN1DYMMc,8601
17
17
  berryworld/pickle_management.py,sha256=5o6UuXBpTj23Jgpz6sj9V-vdcdWBK1xMEckWxT-Whj4,2436
18
18
  berryworld/postgres_connection.py,sha256=whKDnchd5Feqpmxpoh2vlyn36EKHR-dVEULYq0N_4wA,8287
19
- berryworld/power_automate.py,sha256=9rDuRy0v-Ttq-SThid4lOB_tD4ibkyEmobiROpa--g4,25414
19
+ berryworld/power_automate.py,sha256=Y11GoeDEwd3Y2RdvtPPhBSFK65APEceAQKtNo4gVLK4,26464
20
20
  berryworld/sharepoint_con.py,sha256=TuH-Vxk1VxjTi7x80KFssf_J8YPLRXpV27RBaFZi37U,22254
21
21
  berryworld/snowflake_conn.py,sha256=52ugfkyVCbR_Xr8YiZtNwPrwe93_1uE9uRy_VNPT6Gs,2428
22
22
  berryworld/sql_conn.py,sha256=3_uPrn3rJjVr7-9wcXkh0CSitFD2ncQGGZjttFl6ELM,47803
23
23
  berryworld/teams_logging.py,sha256=8NwXyWr4fLj7W6GzAm2nRQCGFDxibQpAHDHHD24FrP8,6997
24
24
  berryworld/transportation_solver.py,sha256=gdlHRgl2wlp5EV0uhKIOYtkkbAlHaFHGktnMgvuENWE,5022
25
- berryworld/verify_keys.py,sha256=J2J505PcmBsQ9bj0XSRtXjpY-8qwpPU1A5LQdFRicFU,4257
25
+ berryworld/verify_keys.py,sha256=X4Nuz3o0XbRDYofbJGvxIDeN5gfWj19PN7lhO6T3hR8,4356
26
26
  berryworld/vivantio.py,sha256=QfZo0UKqkzVRg_LyiwivNd3aEup4TH57x4KxLZkCJwc,10627
27
27
  berryworld/vivantio_logging.py,sha256=ciy7gA4u3FrgUIpEBnMgocbNPp6jcu9TPoy-kLcrTZU,5736
28
28
  berryworld/xml_parser.py,sha256=HWD71NaTN3DaIOGT6Wzxs4CEsroFhGQwe9iPLIL80Co,957
@@ -30,8 +30,8 @@ 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.183171.dist-info/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
34
- berryworld-1.0.0.183171.dist-info/METADATA,sha256=9Fkg4NysntUtoU-6iu1cXIQbYTm5_-BlytJOIVzVPm8,1174
35
- berryworld-1.0.0.183171.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
36
- berryworld-1.0.0.183171.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
37
- berryworld-1.0.0.183171.dist-info/RECORD,,
33
+ berryworld-1.0.0.184575.dist-info/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
34
+ berryworld-1.0.0.184575.dist-info/METADATA,sha256=1OrVvY4YkefURNgG63cb4pQAGmpIUCN-9m7uFZuMJgU,1371
35
+ berryworld-1.0.0.184575.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
36
+ berryworld-1.0.0.184575.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
37
+ berryworld-1.0.0.184575.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5