berryworld 1.0.0.195284__py3-none-any.whl → 1.0.0.195296__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/email_con.py CHANGED
@@ -1,3 +1,4 @@
1
+ import ast
1
2
  import base64
2
3
  import json
3
4
  import copy
@@ -12,12 +13,49 @@ from msal import ClientApplication
12
13
  class EmailConnection:
13
14
  """ Tooling to connect to Outlook and manage emails. Use the Graphql Outlook API """
14
15
 
15
- def __init__(self, client_id, authority, client_secret, email_user, email_password, days_back=10):
16
- self.client_id = client_id
17
- self.authority = authority
18
- self.client_secret = client_secret
19
- self.email_user = email_user
20
- self.email_password = email_password
16
+ def __init__(self, email_creds, days_back=10):
17
+ """ Initialize the class
18
+ :param email_creds: Dictionary containing the credentials to connect to the email account
19
+ :param days_back: Number of days back to query emails
20
+
21
+ email_creds = {
22
+ 'authority': '',
23
+ 'box': '',
24
+ 'client_id': '',
25
+ 'client_secret': '',
26
+ 'pwd': ''
27
+ }
28
+ """
29
+ try:
30
+ self.email_creds = ast.literal_eval(email_creds)
31
+ except Exception as e:
32
+ raise ValueError(f'Email credentials not properly formatted. ERROR: {e}')
33
+
34
+ if 'authority' not in email_creds.keys():
35
+ raise ValueError(f"Authority not provided in email credentials")
36
+ else:
37
+ self.authority = self.email_creds['authority']
38
+
39
+ if 'client_id' not in email_creds.keys():
40
+ raise ValueError(f"ClientId not provided in email credentials")
41
+ else:
42
+ self.client_id = self.email_creds['client_id']
43
+
44
+ if 'client_secret' not in email_creds.keys():
45
+ raise ValueError(f"Client Secret not provided in email credentials")
46
+ else:
47
+ self.client_secret = self.email_creds['client_secret']
48
+
49
+ if 'box' not in email_creds.keys():
50
+ raise ValueError(f"Email Box not provided in email credentials")
51
+ else:
52
+ self.email_user = self.email_creds['box']
53
+
54
+ if 'pwd' not in email_creds.keys():
55
+ raise ValueError(f"Password not provided in email credentials")
56
+ else:
57
+ self.email_password = self.email_creds['pwd']
58
+
21
59
  self.base_url = "https://graph.microsoft.com/v1.0"
22
60
  self.headers = self.get_headers()
23
61
  self.days_back = days_back
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: berryworld
3
- Version: 1.0.0.195284
3
+ Version: 1.0.0.195296
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -6,7 +6,7 @@ berryworld/app_logs_query.py,sha256=U94b-z3X9cuY_KFozupUcfaYciXWBn7p_RHkoRsfROU,
6
6
  berryworld/cache_data.py,sha256=AWAhV4PPkilZ4Xb1pUXuuu6UdHICAx8QqDtb9rVnjDM,2254
7
7
  berryworld/credentials.py,sha256=oyBvdf0q6KrofONGWIhLDTcIIon0pkA0vGOyI_dt8AE,6649
8
8
  berryworld/devops.py,sha256=7mRbyZPGzk5ox-6J2etv3NxCcfP4cprG0_Xelh7prn8,9776
9
- berryworld/email_con.py,sha256=uSBzs_Ijz9pUPWt9e7U3TCB7i6q7hU1bB5vhsTB_tmw,14448
9
+ berryworld/email_con.py,sha256=hzvjZ26JAUFBl70Yw7RK0_xg0k9nLUeFTDs3WvPbq1s,15781
10
10
  berryworld/email_logging.py,sha256=LeSrTExhQhar49gJR2wGC1dS0lqsNpFl9pS3eYWqnuo,4936
11
11
  berryworld/generate_env.py,sha256=B-d4Tu5M69j4CFfQjby3kNXxndIJhb4O9H-v94L6iwI,11204
12
12
  berryworld/handy_mix.py,sha256=ZPr5Z4l5TfyXQjhuLjttGi90whBooTQhB7M-Lq5L1DQ,10683
@@ -26,12 +26,12 @@ berryworld/verify_keys.py,sha256=X7VUHqYDklWPDO0bGVHIOXeLq5Qi4fZRZbHYw5x7UnA,435
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.195284.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
29
+ berryworld-1.0.0.195296.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.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,,
34
+ berryworld-1.0.0.195296.dist-info/METADATA,sha256=30ohY0AEk7NjIVDvlt77hxMrPvCpkObT8UHQi8nzyP0,1445
35
+ berryworld-1.0.0.195296.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ berryworld-1.0.0.195296.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
37
+ berryworld-1.0.0.195296.dist-info/RECORD,,