wcp-library 1.0.0__py3-none-any.whl → 1.0.2__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.
@@ -3,7 +3,7 @@ import logging
3
3
  import aiohttp
4
4
  from yarl import URL
5
5
 
6
- from WCP_Library.async_credentials import MissingCredentialsError
6
+ from wcp_library.async_credentials import MissingCredentialsError
7
7
 
8
8
  logger = logging.getLogger(__name__)
9
9
 
@@ -3,7 +3,7 @@ import logging
3
3
  import aiohttp
4
4
  from yarl import URL
5
5
 
6
- from WCP_Library.async_credentials import MissingCredentialsError
6
+ from wcp_library.async_credentials import MissingCredentialsError
7
7
 
8
8
  logger = logging.getLogger(__name__)
9
9
 
@@ -5,7 +5,7 @@ import pandas as pd
5
5
  import oracledb
6
6
  from oracledb import AsyncConnectionPool
7
7
 
8
- from WCP_Library.async_sql import retry
8
+ from wcp_library.async_sql import retry
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
@@ -36,7 +36,7 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
36
36
  return session_pool
37
37
 
38
38
 
39
- class SQLConnection(object):
39
+ class AsyncOracleConnection(object):
40
40
  """
41
41
  SQL Connection Class
42
42
 
@@ -78,7 +78,7 @@ class SQLConnection(object):
78
78
  :return: None
79
79
  """
80
80
 
81
- if not any([self._database, self._sid]):
81
+ if not all([credentials_dict['Service'], credentials_dict['SID']]):
82
82
  raise ValueError("Either Service or SID must be provided")
83
83
 
84
84
  self._username: Optional[str] = credentials_dict['UserName']
@@ -5,7 +5,7 @@ import pandas as pd
5
5
  from psycopg.sql import SQL
6
6
  from psycopg_pool import AsyncConnectionPool
7
7
 
8
- from WCP_Library.async_sql import retry
8
+ from wcp_library.async_sql import retry
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
@@ -33,7 +33,7 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
33
33
  return session_pool
34
34
 
35
35
 
36
- class SQLConnection(object):
36
+ class AsyncPostgresConnection(object):
37
37
  """
38
38
  SQL Connection Class
39
39
 
@@ -3,7 +3,7 @@ import logging
3
3
  import requests
4
4
  from yarl import URL
5
5
 
6
- from WCP_Library.credentials import MissingCredentialsError
6
+ from wcp_library.credentials import MissingCredentialsError
7
7
 
8
8
  logger = logging.getLogger(__name__)
9
9
 
@@ -3,7 +3,7 @@ import logging
3
3
  import requests
4
4
  from yarl import URL
5
5
 
6
- from WCP_Library.credentials import MissingCredentialsError
6
+ from wcp_library.credentials import MissingCredentialsError
7
7
 
8
8
  logger = logging.getLogger(__name__)
9
9
 
wcp_library/emailing.py CHANGED
@@ -2,6 +2,7 @@ import smtplib
2
2
  from email import encoders
3
3
  from email.mime.base import MIMEBase
4
4
  from email.mime.multipart import MIMEMultipart
5
+ from email.mime.text import MIMEText
5
6
  from email.utils import formatdate
6
7
  from pathlib import Path
7
8
 
@@ -22,7 +23,7 @@ def send_email(sender: str, recipients: list, subject: str, message=None):
22
23
  msg['To'] = ", ".join(recipients)
23
24
  msg['Date'] = formatdate(localtime=True)
24
25
  msg['Subject'] = subject
25
- msg.attach(message)
26
+ msg.attach(MIMEText(message))
26
27
 
27
28
  smtpServer = 'mail.wcap.ca'
28
29
  server = smtplib.SMTP(smtpServer, 25)
@@ -45,7 +46,7 @@ def email_reporting(subject: str, message: str):
45
46
  msg['To'] = "Reporting@wcap.ca"
46
47
  msg['Date'] = formatdate(localtime=True)
47
48
  msg['Subject'] = subject
48
- msg.attach(message)
49
+ msg.attach(MIMEText(message))
49
50
 
50
51
  smtpServer = 'mail.wcap.ca'
51
52
  server = smtplib.SMTP(smtpServer, 25)
@@ -73,7 +74,7 @@ def email_with_attachments(sender: str, recipients: list, subject: str, message=
73
74
  msg['To'] = ", ".join(recipients)
74
75
  msg['Date'] = formatdate(localtime=True)
75
76
  msg['Subject'] = subject
76
- msg.attach(message)
77
+ msg.attach(MIMEText(message))
77
78
 
78
79
  for attachment in attachments:
79
80
  part = MIMEBase('application', "octet-stream")
wcp_library/logging.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  import sys
3
3
 
4
- from WCP_Library import application_path
4
+ from wcp_library import application_path
5
5
 
6
6
 
7
7
  def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
wcp_library/sql/oracle.py CHANGED
@@ -5,7 +5,7 @@ import pandas as pd
5
5
  import oracledb
6
6
  from oracledb import ConnectionPool
7
7
 
8
- from WCP_Library.sql import retry
8
+ from wcp_library.sql import retry
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
@@ -36,7 +36,7 @@ def connect_warehouse(username: str, password: str, hostname: str, port: int, da
36
36
  return session_pool
37
37
 
38
38
 
39
- class SQLConnection(object):
39
+ class OracleConnection(object):
40
40
  """
41
41
  SQL Connection Class
42
42
 
@@ -76,7 +76,7 @@ class SQLConnection(object):
76
76
  :return: None
77
77
  """
78
78
 
79
- if not any([self._database, self._sid]):
79
+ if not all([credentials_dict['Service'], credentials_dict['SID']]):
80
80
  raise ValueError("Either Service or SID must be provided")
81
81
 
82
82
  self._username: Optional[str] = credentials_dict['UserName']
@@ -5,7 +5,7 @@ import pandas as pd
5
5
  from psycopg.sql import SQL
6
6
  from psycopg_pool import ConnectionPool
7
7
 
8
- from WCP_Library.sql import retry
8
+ from wcp_library.sql import retry
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
 
@@ -33,7 +33,7 @@ def connect_warehouse(username: str, password: str, hostname: str, port: int, da
33
33
  return session_pool
34
34
 
35
35
 
36
- class SQLConnection(object):
36
+ class PostgresConnection(object):
37
37
  """
38
38
  SQL Connection Class
39
39
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wcp-library
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Common utilites for internal development at WCP
5
5
  Home-page: https://github.com/Whitecap-DNA/WCP-Library
6
6
  Author: Mitch-Petersen
@@ -0,0 +1,21 @@
1
+ wcp_library/__init__.py,sha256=6K37HAqbOuim9T1s-C5GlYW9sQ2AuDKh5z_TlvHvy0U,337
2
+ wcp_library/async_credentials/__init__.py,sha256=ny6UitVV_xIecVzaWuHrJO9LpywBPke6u4C0F2wiM7o,1881
3
+ wcp_library/async_credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ wcp_library/async_credentials/oracle.py,sha256=nJhu2Hh-YvgdQntWMhPnMMyv2GCGv336o0GTPqORajQ,5435
5
+ wcp_library/async_credentials/postgres.py,sha256=T4edRHrAbiDmN9bCHoHnzRrnhK6HZSheWAfI1h3qLns,5296
6
+ wcp_library/async_sql/__init__.py,sha256=m4eWmUGYUEDomhhOp1ScB2uSIXFsNUNO589o5RwWdyM,1035
7
+ wcp_library/async_sql/oracle.py,sha256=OdbYa4BhXKC39dGu21NmYKy_ofBgFAXC3NcGftNcJ9M,7076
8
+ wcp_library/async_sql/postgres.py,sha256=UQ5qLVV7__7qaft0237gq3E-sBupCf4zhU-cGX5Gln4,6193
9
+ wcp_library/credentials/__init__.py,sha256=HRmg7mqcATeclIz3lZQjSR4nmK6aY6MK9-QXEYZoFrw,1857
10
+ wcp_library/credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ wcp_library/credentials/oracle.py,sha256=tinrog9TLW6jw7j8S-Ese_VHnhFcAoOPJpHsE0Xwx6M,5094
12
+ wcp_library/credentials/postgres.py,sha256=Li-4nDMMxKGYh-hKhhL1r9M4wIc_TRgEgP1_UkEf-90,4955
13
+ wcp_library/emailing.py,sha256=T8WXvMRA6cC0uRvyCw9yZcI-pAnCn0Gbn5B_ftRzEqA,2462
14
+ wcp_library/informatica.py,sha256=IXZtk_9X1XLbOEwFrsyOwTgajQKvtXgANBHmuTOP3Kk,4064
15
+ wcp_library/logging.py,sha256=h8p_Ezo_QPSIKrPxzIlNVXddU4IXHyp1_2NqVDirfuk,1958
16
+ wcp_library/sql/__init__.py,sha256=CLlBEBrWVAwE79bUxuQiwikSrYH8m9QRYSJ2l0-ofsY,1003
17
+ wcp_library/sql/oracle.py,sha256=9EDH6EYq_ph46l7Ug72vy6jUAOit4aAJcExQqbIuusk,6892
18
+ wcp_library/sql/postgres.py,sha256=rhRmxAwQI6LAu6Pk2Q3IGezo4BB1Ela7fvVfF1vRefc,6098
19
+ wcp_library-1.0.2.dist-info/METADATA,sha256=YEKtvruW9qW88FPElYr8LdWSeCeOGWuZzvk1ueSpSg8,1338
20
+ wcp_library-1.0.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
21
+ wcp_library-1.0.2.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- wcp_library/__init__.py,sha256=6K37HAqbOuim9T1s-C5GlYW9sQ2AuDKh5z_TlvHvy0U,337
2
- wcp_library/async_credentials/__init__.py,sha256=ny6UitVV_xIecVzaWuHrJO9LpywBPke6u4C0F2wiM7o,1881
3
- wcp_library/async_credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- wcp_library/async_credentials/oracle.py,sha256=npzglbl9w2N9R-mJ7OTp_PYPea_NH8H4cGOzY4seADk,5435
5
- wcp_library/async_credentials/postgres.py,sha256=-KW1i-tLrTX8hRaYx8lRqOZRT-H6RJXOM0LgjXjQYGM,5296
6
- wcp_library/async_sql/__init__.py,sha256=m4eWmUGYUEDomhhOp1ScB2uSIXFsNUNO589o5RwWdyM,1035
7
- wcp_library/async_sql/oracle.py,sha256=iEQ81tYRy0JFWGHKOwLD235o_ZYV996c7ry806-q3x4,7041
8
- wcp_library/async_sql/postgres.py,sha256=HfOUWQ2r8I5AfponwheEjYcHW5EmzPXL99SLUQFhmJA,6183
9
- wcp_library/credentials/__init__.py,sha256=HRmg7mqcATeclIz3lZQjSR4nmK6aY6MK9-QXEYZoFrw,1857
10
- wcp_library/credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- wcp_library/credentials/oracle.py,sha256=Av5UiMxZJvrTEdSAfO5K8SNPxbCljLW1dhoqhl-vMV4,5094
12
- wcp_library/credentials/postgres.py,sha256=XBlXup-On8oyusXN4Z-rue3GzXROTA12Xm2TTR-hVKs,4955
13
- wcp_library/emailing.py,sha256=u9BmHPH9VPZPJasQCZiGDd8_sG1ZfBEPdNF46LSUJK0,2395
14
- wcp_library/informatica.py,sha256=IXZtk_9X1XLbOEwFrsyOwTgajQKvtXgANBHmuTOP3Kk,4064
15
- wcp_library/logging.py,sha256=wo3DTDaoNzCfokIfhKMX2M_SViBjFQ_YVI8GY993csU,1958
16
- wcp_library/sql/__init__.py,sha256=CLlBEBrWVAwE79bUxuQiwikSrYH8m9QRYSJ2l0-ofsY,1003
17
- wcp_library/sql/oracle.py,sha256=c_FWpM71s2Whp2vAv-AiPKyWv20rZ8M6zYwxNlJ3Wlo,6862
18
- wcp_library/sql/postgres.py,sha256=5vtEtG3nlbr2vHflVsq9D45_5S_XTFdEPfoqWDSkGCM,6093
19
- wcp_library-1.0.0.dist-info/METADATA,sha256=hWIiWqhsqBDtczv2pPAYVIar0cM1ZrGR4znYVCmchVA,1338
20
- wcp_library-1.0.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
21
- wcp_library-1.0.0.dist-info/RECORD,,