wcp-library 1.3.4__py3-none-any.whl → 1.3.6__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.
- wcp_library/credentials/{credential_manager_asynchronous.py → _credential_manager_asynchronous.py} +21 -4
- wcp_library/credentials/{credential_manager_synchronous.py → _credential_manager_synchronous.py} +8 -4
- wcp_library/credentials/api.py +74 -0
- wcp_library/credentials/ftp.py +2 -2
- wcp_library/credentials/internet.py +66 -0
- wcp_library/credentials/oracle.py +2 -2
- wcp_library/credentials/postgres.py +2 -2
- wcp_library/selenium_helper.py +11 -0
- {wcp_library-1.3.4.dist-info → wcp_library-1.3.6.dist-info}/METADATA +1 -1
- {wcp_library-1.3.4.dist-info → wcp_library-1.3.6.dist-info}/RECORD +11 -9
- {wcp_library-1.3.4.dist-info → wcp_library-1.3.6.dist-info}/WHEEL +0 -0
wcp_library/credentials/{credential_manager_asynchronous.py → _credential_manager_asynchronous.py}
RENAMED
@@ -38,6 +38,8 @@ class AsyncCredentialManager(ABC):
|
|
38
38
|
for field in password['GenericFieldInfo']:
|
39
39
|
password_info[field['DisplayName']] = field['Value'].lower() if field['DisplayName'].lower() == 'username' else field['Value']
|
40
40
|
password_dict[password['UserName'].lower()] = password_info
|
41
|
+
if password['OTP']:
|
42
|
+
password_dict[password['UserName'].lower()]['OTP'] = password['OTP']
|
41
43
|
logger.debug("Credentials retrieved")
|
42
44
|
return password_dict
|
43
45
|
|
@@ -62,6 +64,8 @@ class AsyncCredentialManager(ABC):
|
|
62
64
|
password_info = {'PasswordID': password['PasswordID'], 'UserName': password['UserName'], 'Password': password['Password']}
|
63
65
|
for field in password['GenericFieldInfo']:
|
64
66
|
password_info[field['DisplayName']] = field['Value'].lower() if field['DisplayName'].lower() == 'username' else field['Value']
|
67
|
+
if password['OTP']:
|
68
|
+
password_info['OTP'] = password['OTP']
|
65
69
|
return password_info
|
66
70
|
|
67
71
|
async def _publish_new_password(self, data: dict) -> bool:
|
@@ -99,14 +103,24 @@ class AsyncCredentialManager(ABC):
|
|
99
103
|
logger.debug(f"Credentials for {username} retrieved")
|
100
104
|
return return_credential
|
101
105
|
|
106
|
+
async def get_credential_by_id(self, password_id: int) -> dict:
|
107
|
+
"""
|
108
|
+
Get the credentials for a specific Password ID
|
109
|
+
|
110
|
+
:param password_id:
|
111
|
+
:return:
|
112
|
+
"""
|
113
|
+
|
114
|
+
logger.debug(f"Getting credentials for ID {password_id}")
|
115
|
+
credential = await self._get_credential(password_id)
|
116
|
+
logger.debug(f"Credentials for ID {password_id} retrieved")
|
117
|
+
return credential
|
118
|
+
|
102
119
|
async def update_credential(self, credentials_dict: dict) -> bool:
|
103
120
|
"""
|
104
121
|
Update username and password in PasswordState
|
105
122
|
|
106
|
-
Credentials dictionary must
|
107
|
-
- PasswordID
|
108
|
-
- UserName
|
109
|
-
- Password
|
123
|
+
Credentials dictionary must the same keys as the original dictionary from the get_credentials method
|
110
124
|
|
111
125
|
The dictionary can be obtained from the get_credentials method
|
112
126
|
|
@@ -114,6 +128,9 @@ class AsyncCredentialManager(ABC):
|
|
114
128
|
:return:
|
115
129
|
"""
|
116
130
|
|
131
|
+
if "OTP" in credentials_dict:
|
132
|
+
credentials_dict.pop("OTP")
|
133
|
+
|
117
134
|
logger.debug(f"Updating credentials for {credentials_dict['UserName']}")
|
118
135
|
url = (self.password_url / str(self._password_list_id)).with_query("QueryAll")
|
119
136
|
async with aiohttp.ClientSession() as session:
|
wcp_library/credentials/{credential_manager_synchronous.py → _credential_manager_synchronous.py}
RENAMED
@@ -36,6 +36,8 @@ class CredentialManager(ABC):
|
|
36
36
|
for field in password['GenericFieldInfo']:
|
37
37
|
password_info[field['DisplayName']] = field['Value'].lower() if field['DisplayName'].lower() == 'username' else field['Value']
|
38
38
|
password_dict[password['UserName'].lower()] = password_info
|
39
|
+
if password['OTP']:
|
40
|
+
password_dict[password['UserName'].lower()]['OTP'] = password['OTP']
|
39
41
|
logger.debug("Credentials retrieved")
|
40
42
|
return password_dict
|
41
43
|
|
@@ -58,6 +60,8 @@ class CredentialManager(ABC):
|
|
58
60
|
password_info = {'PasswordID': password['PasswordID'], 'UserName': password['UserName'], 'Password': password['Password']}
|
59
61
|
for field in password['GenericFieldInfo']:
|
60
62
|
password_info[field['DisplayName']] = field['Value'].lower() if field['DisplayName'].lower() == 'username' else field['Value']
|
63
|
+
if password['OTP']:
|
64
|
+
password_info['OTP'] = password['OTP']
|
61
65
|
logger.debug("Credential retrieved")
|
62
66
|
return password_info
|
63
67
|
|
@@ -110,10 +114,7 @@ class CredentialManager(ABC):
|
|
110
114
|
"""
|
111
115
|
Update the credentials for a specific username
|
112
116
|
|
113
|
-
Credentials dictionary must
|
114
|
-
- PasswordID
|
115
|
-
- UserName
|
116
|
-
- Password
|
117
|
+
Credentials dictionary must the same keys as the original dictionary from the get_credentials method
|
117
118
|
|
118
119
|
The dictionary should be obtained from the get_credentials method and modified accordingly
|
119
120
|
|
@@ -121,6 +122,9 @@ class CredentialManager(ABC):
|
|
121
122
|
:return: True if successful, False otherwise
|
122
123
|
"""
|
123
124
|
|
125
|
+
if "OTP" in credentials_dict:
|
126
|
+
credentials_dict.pop("OTP")
|
127
|
+
|
124
128
|
logger.debug(f"Updating credentials for {credentials_dict['UserName']}")
|
125
129
|
url = (self.password_url / str(self._password_list_id)).with_query("QueryAll")
|
126
130
|
passwords = requests.get(str(url), headers=self.headers).json()
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
from wcp_library.credentials._credential_manager_asynchronous import AsyncCredentialManager
|
4
|
+
from wcp_library.credentials._credential_manager_synchronous import CredentialManager
|
5
|
+
|
6
|
+
logger = logging.getLogger(__name__)
|
7
|
+
|
8
|
+
|
9
|
+
class APICredentialManager(CredentialManager):
|
10
|
+
def __init__(self, passwordState_api_key: str):
|
11
|
+
super().__init__(passwordState_api_key, 214)
|
12
|
+
|
13
|
+
def new_credentials(self, credentials_dict: dict) -> bool:
|
14
|
+
"""
|
15
|
+
Create a new credential entry
|
16
|
+
|
17
|
+
Credentials dictionary can have the following keys:
|
18
|
+
- Title
|
19
|
+
- UserName
|
20
|
+
- Password
|
21
|
+
- API KEY
|
22
|
+
- Authentication Header
|
23
|
+
- URL
|
24
|
+
|
25
|
+
:param credentials_dict:
|
26
|
+
:return: True if successful, False otherwise
|
27
|
+
"""
|
28
|
+
|
29
|
+
data = {
|
30
|
+
"PasswordListID": self._password_list_id,
|
31
|
+
"Title": credentials_dict['UserName'].upper() if "Title" not in credentials_dict else credentials_dict['Title'].upper(),
|
32
|
+
"Notes": credentials_dict['Notes'] if 'Notes' in credentials_dict else None,
|
33
|
+
"UserName": credentials_dict['UserName'],
|
34
|
+
"Password": credentials_dict['Password'],
|
35
|
+
"GenericField1": credentials_dict['API KEY'],
|
36
|
+
"GenericField2": credentials_dict['Authentication Header'],
|
37
|
+
"URL": credentials_dict['URL']
|
38
|
+
}
|
39
|
+
|
40
|
+
return self._publish_new_password(data)
|
41
|
+
|
42
|
+
|
43
|
+
class AsyncAPICredentialManager(AsyncCredentialManager):
|
44
|
+
def __init__(self, passwordState_api_key: str):
|
45
|
+
super().__init__(passwordState_api_key, 214)
|
46
|
+
|
47
|
+
async def new_credentials(self, credentials_dict: dict) -> bool:
|
48
|
+
"""
|
49
|
+
Create a new credential entry
|
50
|
+
|
51
|
+
Credentials dictionary can have the following keys:
|
52
|
+
- Title
|
53
|
+
- UserName
|
54
|
+
- Password
|
55
|
+
- API KEY
|
56
|
+
- Authentication Header
|
57
|
+
- URL
|
58
|
+
|
59
|
+
:param credentials_dict:
|
60
|
+
:return:
|
61
|
+
"""
|
62
|
+
|
63
|
+
data = {
|
64
|
+
"PasswordListID": self._password_list_id,
|
65
|
+
"Title": credentials_dict['UserName'].upper() if "Title" not in credentials_dict else credentials_dict['Title'].upper(),
|
66
|
+
"Notes": credentials_dict['Notes'] if 'Notes' in credentials_dict else None,
|
67
|
+
"UserName": credentials_dict['UserName'],
|
68
|
+
"Password": credentials_dict['Password'],
|
69
|
+
"GenericField1": credentials_dict['API KEY'],
|
70
|
+
"GenericField2": credentials_dict['Authentication Header'],
|
71
|
+
"URL": credentials_dict['URL']
|
72
|
+
}
|
73
|
+
|
74
|
+
return await self._publish_new_password(data)
|
wcp_library/credentials/ftp.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
from wcp_library.credentials.
|
4
|
-
from wcp_library.credentials.
|
3
|
+
from wcp_library.credentials._credential_manager_asynchronous import AsyncCredentialManager
|
4
|
+
from wcp_library.credentials._credential_manager_synchronous import CredentialManager
|
5
5
|
|
6
6
|
logger = logging.getLogger(__name__)
|
7
7
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
from wcp_library.credentials._credential_manager_asynchronous import AsyncCredentialManager
|
4
|
+
from wcp_library.credentials._credential_manager_synchronous import CredentialManager
|
5
|
+
|
6
|
+
logger = logging.getLogger(__name__)
|
7
|
+
|
8
|
+
|
9
|
+
class InternetCredentialManager(CredentialManager):
|
10
|
+
def __init__(self, passwordState_api_key: str):
|
11
|
+
super().__init__(passwordState_api_key, 93)
|
12
|
+
|
13
|
+
def new_credentials(self, credentials_dict: dict) -> bool:
|
14
|
+
"""
|
15
|
+
Create a new credential entry
|
16
|
+
|
17
|
+
Credentials dictionary must have the following keys:
|
18
|
+
- Title
|
19
|
+
- UserName
|
20
|
+
- Password
|
21
|
+
- URL
|
22
|
+
|
23
|
+
:param credentials_dict:
|
24
|
+
:return:
|
25
|
+
"""
|
26
|
+
|
27
|
+
data = {
|
28
|
+
"PasswordListID": self._password_list_id,
|
29
|
+
"Title": credentials_dict['UserName'].upper() if "Title" not in credentials_dict else credentials_dict['Title'].upper(),
|
30
|
+
"Notes": credentials_dict['Notes'] if 'Notes' in credentials_dict else None,
|
31
|
+
"UserName": credentials_dict['UserName'].lower(),
|
32
|
+
"Password": credentials_dict['Password'],
|
33
|
+
"URL": credentials_dict['URL']
|
34
|
+
}
|
35
|
+
|
36
|
+
return self._publish_new_password(data)
|
37
|
+
|
38
|
+
|
39
|
+
class AsyncInternetCredentialManager(AsyncCredentialManager):
|
40
|
+
def __init__(self, passwordState_api_key: str):
|
41
|
+
super().__init__(passwordState_api_key, 93)
|
42
|
+
|
43
|
+
async def new_credentials(self, credentials_dict: dict) -> bool:
|
44
|
+
"""
|
45
|
+
Create a new credential entry
|
46
|
+
|
47
|
+
Credentials dictionary must have the following keys:
|
48
|
+
- Title
|
49
|
+
- UserName
|
50
|
+
- Password
|
51
|
+
- URL
|
52
|
+
|
53
|
+
:param credentials_dict:
|
54
|
+
:return:
|
55
|
+
"""
|
56
|
+
|
57
|
+
data = {
|
58
|
+
"PasswordListID": self._password_list_id,
|
59
|
+
"Title": credentials_dict['UserName'].upper() if "Title" not in credentials_dict else credentials_dict['Title'].upper(),
|
60
|
+
"Notes": credentials_dict['Notes'] if 'Notes' in credentials_dict else None,
|
61
|
+
"UserName": credentials_dict['UserName'].lower(),
|
62
|
+
"Password": credentials_dict['Password'],
|
63
|
+
"URL": credentials_dict['URL']
|
64
|
+
}
|
65
|
+
|
66
|
+
return await self._publish_new_password(data)
|
@@ -2,8 +2,8 @@ import logging
|
|
2
2
|
|
3
3
|
import aiohttp
|
4
4
|
|
5
|
-
from wcp_library.credentials.
|
6
|
-
from wcp_library.credentials.
|
5
|
+
from wcp_library.credentials._credential_manager_asynchronous import AsyncCredentialManager
|
6
|
+
from wcp_library.credentials._credential_manager_synchronous import CredentialManager
|
7
7
|
|
8
8
|
logger = logging.getLogger(__name__)
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
from wcp_library.credentials.
|
4
|
-
from wcp_library.credentials.
|
3
|
+
from wcp_library.credentials._credential_manager_asynchronous import AsyncCredentialManager
|
4
|
+
from wcp_library.credentials._credential_manager_synchronous import CredentialManager
|
5
5
|
|
6
6
|
logger = logging.getLogger(__name__)
|
7
7
|
|
wcp_library/selenium_helper.py
CHANGED
@@ -75,3 +75,14 @@ class SeleniumHelper:
|
|
75
75
|
"""
|
76
76
|
|
77
77
|
WebDriverWait(self.driver, timeout).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, css_element)))
|
78
|
+
|
79
|
+
def wait_until_clickable(self, css_element: str, timeout: int = 30) -> None:
|
80
|
+
"""
|
81
|
+
Wait until an element is clickable
|
82
|
+
|
83
|
+
:param css_element:
|
84
|
+
:param timeout:
|
85
|
+
:return:
|
86
|
+
"""
|
87
|
+
|
88
|
+
WebDriverWait(self.driver, timeout).until(expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, css_element)))
|
@@ -1,21 +1,23 @@
|
|
1
1
|
wcp_library/__init__.py,sha256=hwLbcu00uI6L_xjXO9-I0YcODl2WtIOkdNLoDcXv7zk,591
|
2
2
|
wcp_library/credentials/__init__.py,sha256=HRmg7mqcATeclIz3lZQjSR4nmK6aY6MK9-QXEYZoFrw,1857
|
3
|
-
wcp_library/credentials/
|
4
|
-
wcp_library/credentials/
|
5
|
-
wcp_library/credentials/
|
6
|
-
wcp_library/credentials/
|
7
|
-
wcp_library/credentials/
|
3
|
+
wcp_library/credentials/_credential_manager_asynchronous.py,sha256=shdFh1_JG8WUyN4DRhVo5i9d4c9YIL-ca5xhhfkVOZE,6390
|
4
|
+
wcp_library/credentials/_credential_manager_synchronous.py,sha256=QUF3OOUgx0gu2PKFykkB69C-Kf_-9lyo2RIVA2JYvyc,5764
|
5
|
+
wcp_library/credentials/api.py,sha256=NZfZcN46-ZVB_-DatR0DLBYAtJxulDlKD2cculzbyXo,2625
|
6
|
+
wcp_library/credentials/ftp.py,sha256=lSjOlfU68j9PsOCaoWJSdjbR1QmjTxjVmSxOpMdMG7Q,2591
|
7
|
+
wcp_library/credentials/internet.py,sha256=z9tihFddTJcX2pt-iHFP_rkCoheLhTdFgn4ksc2sYYE,2239
|
8
|
+
wcp_library/credentials/oracle.py,sha256=OV02op95LNUT21cNDM4zDbD63C1ldiq--vYofDpU-zU,2869
|
9
|
+
wcp_library/credentials/postgres.py,sha256=B5qNPKYzuzOJZ5S4M3MCN4xUelvZ6AgyR6QJc4z0Cgo,2573
|
8
10
|
wcp_library/emailing.py,sha256=xqNly6Tmj-pvwl5bdys3gauZFDd4SuWCQYzGFNemv2Q,2496
|
9
11
|
wcp_library/ftp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
12
|
wcp_library/ftp/ftp.py,sha256=EpyW0J2QIGxP8zVGD4VarA0hi4C2XAPDPF-0j2sRdpI,4350
|
11
13
|
wcp_library/ftp/sftp.py,sha256=hykXGLGdxe7DYAxFdTwjPjTEOYuIpSMyK3NOiTQNUK0,4176
|
12
14
|
wcp_library/informatica.py,sha256=_g9lzSd-JLsY4e5_g6YcxQtOxP6fkg4sGfvNJaAN7jY,8123
|
13
15
|
wcp_library/logging.py,sha256=e6gG7HFgUrMajUZs4Gs0atFfOJJmdmxN0GerfynNWlY,2061
|
14
|
-
wcp_library/selenium_helper.py,sha256=
|
16
|
+
wcp_library/selenium_helper.py,sha256=2PENUH8bgpyzovbLjP8a4Oyd7c3yOwoyQJt-a8-zq0c,2855
|
15
17
|
wcp_library/sql/__init__.py,sha256=s2psmwkq_ZU23iGWvXjJrLu0hD1fB6CDv6RHcK7y828,1917
|
16
18
|
wcp_library/sql/oracle.py,sha256=TGiTC5L5UcM5QcHFajgn43NI8HygOGIEAtLmLbVFp2I,15772
|
17
19
|
wcp_library/sql/postgres.py,sha256=GElSjLDworrRlzA7DLrbcQlW7BqvhgMbvW89v-yZejk,14533
|
18
20
|
wcp_library/time.py,sha256=ktSzhK7SZnGPNXobFexnhFGQAcriLCJQKxnO0fed8fQ,1740
|
19
|
-
wcp_library-1.3.
|
20
|
-
wcp_library-1.3.
|
21
|
-
wcp_library-1.3.
|
21
|
+
wcp_library-1.3.6.dist-info/METADATA,sha256=4AtGuuDkPHngl78hTA_sOGk4haucvL2HKzmh3w6TKMc,1552
|
22
|
+
wcp_library-1.3.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
23
|
+
wcp_library-1.3.6.dist-info/RECORD,,
|
File without changes
|