berryworld 1.0.0.194849__py3-none-any.whl → 1.0.0.195284__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/sharepoint_con.py +21 -6
- berryworld/snowflake_conn.py +26 -19
- berryworld/sql_connenction.py +25 -12
- {berryworld-1.0.0.194849.dist-info → berryworld-1.0.0.195284.dist-info}/METADATA +1 -1
- {berryworld-1.0.0.194849.dist-info → berryworld-1.0.0.195284.dist-info}/RECORD +8 -8
- {berryworld-1.0.0.194849.dist-info → berryworld-1.0.0.195284.dist-info}/WHEEL +0 -0
- {berryworld-1.0.0.194849.dist-info → berryworld-1.0.0.195284.dist-info}/licenses/LICENSE +0 -0
- {berryworld-1.0.0.194849.dist-info → berryworld-1.0.0.195284.dist-info}/top_level.txt +0 -0
berryworld/sharepoint_con.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import ast
|
|
2
3
|
import msal
|
|
3
4
|
import urllib
|
|
4
5
|
import requests
|
|
@@ -462,6 +463,8 @@ class SharepointConn:
|
|
|
462
463
|
"""
|
|
463
464
|
if os.environ.get(f"SHAREPOINT-{env_name.upper()}") is None:
|
|
464
465
|
raise ValueError(f'Sharepoint environment {env_name} not found in the environment variables')
|
|
466
|
+
else:
|
|
467
|
+
sp_creds = ast.literal_eval(os.environ.get(f"SHAREPOINT-{env_name.upper()}"))
|
|
465
468
|
|
|
466
469
|
if api_version is None:
|
|
467
470
|
self.api_version = 'v1.0'
|
|
@@ -469,15 +472,27 @@ class SharepointConn:
|
|
|
469
472
|
self.api_version = api_version
|
|
470
473
|
|
|
471
474
|
try:
|
|
472
|
-
self.client_id =
|
|
473
|
-
self.organisation_id =
|
|
475
|
+
self.client_id = sp_creds['client_id']
|
|
476
|
+
self.organisation_id = sp_creds['organization_id']
|
|
474
477
|
except Exception as e:
|
|
475
478
|
print(e)
|
|
476
|
-
raise ValueError(f"
|
|
479
|
+
raise ValueError(f"Auth not found in {env_name.upper()} SharePoint variable")
|
|
480
|
+
|
|
481
|
+
if 'site_name' not in sp_creds.keys():
|
|
482
|
+
raise ValueError(f"Site Name not provided for {env_name.upper()} SharePoint variable")
|
|
483
|
+
else:
|
|
484
|
+
self.env_name = sp_creds['site_name']
|
|
485
|
+
|
|
486
|
+
if 'user_name' not in sp_creds.keys():
|
|
487
|
+
raise ValueError(f"User Name not provided for {env_name.upper()} SharePoint variable")
|
|
488
|
+
else:
|
|
489
|
+
self.username = sp_creds['user_name']
|
|
490
|
+
|
|
491
|
+
if 'pwd' not in sp_creds.keys():
|
|
492
|
+
raise ValueError(f"Password not provided for {env_name.upper()} SharePoint variable")
|
|
493
|
+
else:
|
|
494
|
+
self.password = sp_creds['pwd']
|
|
477
495
|
|
|
478
|
-
self.env_name = os.environ.get(f"SHAREPOINT-{env_name.upper()}").split(' ')[0]
|
|
479
|
-
self.username = os.environ.get(f"SHAREPOINT-{env_name.upper()}").split(' ')[1]
|
|
480
|
-
self.password = os.environ.get(f"SHAREPOINT-{env_name.upper()}").split(' ')[2]
|
|
481
496
|
self.scopes = ['Sites.ReadWrite.All', 'Files.ReadWrite.All']
|
|
482
497
|
|
|
483
498
|
self.graph_url = f'https://graph.microsoft.com/{self.api_version}'
|
berryworld/snowflake_conn.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import ast
|
|
2
3
|
import pandas as pd
|
|
3
4
|
import snowflake.connector
|
|
4
5
|
|
|
@@ -16,29 +17,35 @@ class SnowflakeConn:
|
|
|
16
17
|
self.server = server
|
|
17
18
|
|
|
18
19
|
try:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
server_creds = os.environ.get(f"SQL-{self.db_reference.upper()}")
|
|
21
|
+
server_creds = ast.literal_eval(server_creds)
|
|
22
|
+
except Exception as e:
|
|
23
|
+
raise ValueError(f'Snowflake DB reference: {self.db_reference} not found. ERROR: {e}')
|
|
22
24
|
|
|
23
25
|
try:
|
|
24
|
-
|
|
25
|
-
except Exception:
|
|
26
|
-
raise
|
|
26
|
+
server_creds = server_creds[self.server.lower()]
|
|
27
|
+
except Exception as e:
|
|
28
|
+
raise ValueError(f'Server: {self.server} not found for Snowflake DB reference: {self.db_reference}. ERROR: {e}')
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
self.
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if 'server_name' not in server_creds.keys():
|
|
31
|
+
raise ValueError(f"Server name not provided for Snowflake {self.db_reference} on {self.server.upper()} server")
|
|
32
|
+
else:
|
|
33
|
+
self.account = server_creds['server_name']
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
self.
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if 'db_name' not in server_creds.keys():
|
|
36
|
+
raise ValueError(f"Database name not provided for Snowflake {self.db_reference} on {self.server.upper()} server")
|
|
37
|
+
else:
|
|
38
|
+
self.db_name = server_creds['db_name']
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
self.
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if 'user_name' not in server_creds.keys():
|
|
41
|
+
raise ValueError(f"User name not provided for Snowflake {self.db_reference} on {self.server.upper()} server")
|
|
42
|
+
else:
|
|
43
|
+
self.user_name = server_creds['user_name']
|
|
44
|
+
|
|
45
|
+
if 'pwd' not in server_creds.keys():
|
|
46
|
+
raise ValueError(f"Password not provided for Snowflake {self.db_reference} on {self.server.upper()} server")
|
|
47
|
+
else:
|
|
48
|
+
self.pwd = server_creds['pwd']
|
|
42
49
|
|
|
43
50
|
self.connect()
|
|
44
51
|
|
|
@@ -46,7 +53,7 @@ class SnowflakeConn:
|
|
|
46
53
|
""" Open the connection to Snowflake """
|
|
47
54
|
self.conn = snowflake.connector.connect(
|
|
48
55
|
user=self.user_name,
|
|
49
|
-
password=self.
|
|
56
|
+
password=self.pwd,
|
|
50
57
|
account=self.account,
|
|
51
58
|
database=self.db_name)
|
|
52
59
|
|
berryworld/sql_connenction.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
|
+
import ast
|
|
3
4
|
import math
|
|
4
5
|
import pyodbc
|
|
5
6
|
import traceback
|
|
@@ -75,24 +76,36 @@ class SQLConnection:
|
|
|
75
76
|
""" Return the credentials used to connect to the SQL Server
|
|
76
77
|
:return: Dictionary with the credentials used to connect to the SQL Server
|
|
77
78
|
"""
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
try:
|
|
80
|
+
server_creds = os.environ.get(f"SQL-{self.db_reference.upper()}")
|
|
81
|
+
server_creds = ast.literal_eval(server_creds)
|
|
82
|
+
except Exception as e:
|
|
83
|
+
raise ValueError(f'DB reference: {self.db_reference} not found. ERROR: {e}')
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
server_creds = server_creds[self.server.lower()]
|
|
87
|
+
except Exception as e:
|
|
88
|
+
raise ValueError(f'Server: {self.server} not found for DB reference: {self.db_reference}. ERROR: {e}')
|
|
89
|
+
|
|
90
|
+
if 'server_name' not in server_creds.keys():
|
|
91
|
+
raise ValueError(f"Server name not provided for {self.db_reference} on {self.server.upper()} server")
|
|
86
92
|
else:
|
|
93
|
+
server_name = server_creds['server_name']
|
|
94
|
+
|
|
95
|
+
if 'db_name' not in server_creds.keys():
|
|
87
96
|
raise ValueError(f"Database name not provided for {self.db_reference} on {self.server.upper()} server")
|
|
88
|
-
if len(server_creds) > 2:
|
|
89
|
-
user_name = server_creds[2]
|
|
90
97
|
else:
|
|
98
|
+
db_name = server_creds['db_name']
|
|
99
|
+
|
|
100
|
+
if 'user_name' not in server_creds.keys():
|
|
91
101
|
raise ValueError(f"User name not provided for {self.db_reference} on {self.server.upper()} server")
|
|
92
|
-
if len(server_creds) > 3:
|
|
93
|
-
password = server_creds[3]
|
|
94
102
|
else:
|
|
103
|
+
user_name = server_creds['user_name']
|
|
104
|
+
|
|
105
|
+
if 'pwd' not in server_creds.keys():
|
|
95
106
|
raise ValueError(f"Password not provided for {self.db_reference} on {self.server.upper()} server")
|
|
107
|
+
else:
|
|
108
|
+
password = server_creds['pwd']
|
|
96
109
|
|
|
97
110
|
return re.sub(r'(\\)\1*', r'\1', server_name), db_name, user_name, password
|
|
98
111
|
|
|
@@ -16,22 +16,22 @@ berryworld/microsoft_teams.py,sha256=8uPo0yku-euBj2VdzBoZCeX3IcsCCOqISLqaVZUVxfA
|
|
|
16
16
|
berryworld/persistent_storage.py,sha256=L15kLyzN42T6UB1WAg8rFXJq3Mdb1M8Sw4P5YQaUN84,8711
|
|
17
17
|
berryworld/pickle_management.py,sha256=5o6UuXBpTj23Jgpz6sj9V-vdcdWBK1xMEckWxT-Whj4,2436
|
|
18
18
|
berryworld/power_automate.py,sha256=V86QEGG9H36DrDvod9Q6yp8OUu307hfYcXJhw06pYrA,27912
|
|
19
|
-
berryworld/sharepoint_con.py,sha256=
|
|
20
|
-
berryworld/snowflake_conn.py,sha256=
|
|
19
|
+
berryworld/sharepoint_con.py,sha256=nmyZJIcaAKJ6Y-ti4gQbvzA_rRbrMGIxTDXe4eP-tiI,44950
|
|
20
|
+
berryworld/snowflake_conn.py,sha256=o0IQCfVM-xkVL9zI3i95hqH2Yw8PqmbwZLNS0wj50rU,3155
|
|
21
21
|
berryworld/sql_conn.py,sha256=tYKgD8ja7NQuvLB1WBjdsJbPcm3eX1Y76QPTEgx8R8Q,47564
|
|
22
|
-
berryworld/sql_connenction.py,sha256=
|
|
22
|
+
berryworld/sql_connenction.py,sha256=FPlhDxy7Pp5caGoFcSi2fV32P58YCSzAqKimAHfUNkU,48862
|
|
23
23
|
berryworld/teams_logging.py,sha256=8NwXyWr4fLj7W6GzAm2nRQCGFDxibQpAHDHHD24FrP8,6997
|
|
24
24
|
berryworld/transportation_solver.py,sha256=tNc1JJk71azIBccdWVHbqcvXWhalOdKffv6HmBD6tG0,5014
|
|
25
25
|
berryworld/verify_keys.py,sha256=X7VUHqYDklWPDO0bGVHIOXeLq5Qi4fZRZbHYw5x7UnA,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
|
|
29
|
-
berryworld-1.0.0.
|
|
29
|
+
berryworld-1.0.0.195284.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
|
|
30
30
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
|
|
32
32
|
tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
|
|
33
33
|
tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
|
|
34
|
-
berryworld-1.0.0.
|
|
35
|
-
berryworld-1.0.0.
|
|
36
|
-
berryworld-1.0.0.
|
|
37
|
-
berryworld-1.0.0.
|
|
34
|
+
berryworld-1.0.0.195284.dist-info/METADATA,sha256=68eicTgRce_a3WgLVZkuRvRTis2uf-2HLEwFJ6QlXU0,1445
|
|
35
|
+
berryworld-1.0.0.195284.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
36
|
+
berryworld-1.0.0.195284.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
|
|
37
|
+
berryworld-1.0.0.195284.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|