ITK-dev-shared-components 2.11.1__tar.gz → 2.12.1__tar.gz
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.
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/PKG-INFO +2 -1
- itk_dev_shared_components-2.12.1/itk_dev_shared_components/getorganized/go_api.py +154 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/fmcacov.py +14 -7
- itk_dev_shared_components-2.12.1/itk_dev_shared_components/smtp/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components.egg-info/PKG-INFO +2 -1
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components.egg-info/SOURCES.txt +2 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components.egg-info/requires.txt +1 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/pyproject.toml +3 -2
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/LICENSE +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/README.md +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/eflyt/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/eflyt/eflyt_case.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/eflyt/eflyt_login.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/eflyt/eflyt_search.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/eflyt/eflyt_util.py +0 -0
- {itk_dev_shared_components-2.11.1/itk_dev_shared_components/graph → itk_dev_shared_components-2.12.1/itk_dev_shared_components/getorganized}/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1/itk_dev_shared_components/misc → itk_dev_shared_components-2.12.1/itk_dev_shared_components/graph}/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/graph/authentication.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/graph/common.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/graph/file.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/graph/mail.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/graph/site.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/authentication.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/cpr.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/nova_cases.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/nova_documents.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/nova_notes.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/nova_objects.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/nova_tasks.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/kmd_nova/util.py +0 -0
- {itk_dev_shared_components-2.11.1/itk_dev_shared_components/sap → itk_dev_shared_components-2.12.1/itk_dev_shared_components/misc}/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/misc/address_lookup.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/misc/cpr_util.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/misc/cvr_lookup.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/misc/file_util.py +0 -0
- {itk_dev_shared_components-2.11.1/itk_dev_shared_components/smtp → itk_dev_shared_components-2.12.1/itk_dev_shared_components/sap}/__init__.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/gridview_util.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/multi_session.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/opret_kundekontakt.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/sap_login.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/sap_util.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/sap/tree_util.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components/smtp/smtp_util.py +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components.egg-info/dependency_links.txt +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/itk_dev_shared_components.egg-info/top_level.txt +0 -0
- {itk_dev_shared_components-2.11.1 → itk_dev_shared_components-2.12.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itk_dev_shared_components
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.12.1
|
|
4
4
|
Summary: Shared components to use in RPA projects
|
|
5
5
|
Author-email: ITK Development <itk-rpa@mkb.aarhus.dk>
|
|
6
6
|
Project-URL: Homepage, https://github.com/itk-dev-rpa/itk-dev-shared-components
|
|
@@ -17,6 +17,7 @@ Requires-Dist: requests==2.*
|
|
|
17
17
|
Requires-Dist: beautifulsoup4==4.*
|
|
18
18
|
Requires-Dist: selenium==4.*
|
|
19
19
|
Requires-Dist: uiautomation==2.*
|
|
20
|
+
Requires-Dist: requests_ntlm==1.*
|
|
20
21
|
Provides-Extra: dev
|
|
21
22
|
Requires-Dist: python-dotenv; extra == "dev"
|
|
22
23
|
Requires-Dist: flake8; extra == "dev"
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Functions for working with the GetOrganized API."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from urllib.parse import urljoin
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
from requests import Session
|
|
8
|
+
from requests_ntlm import HttpNtlmAuth
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def create_session(username: str, password: str) -> Session:
|
|
12
|
+
"""Create a session for accessing GetOrganized API.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
username: Username for login.
|
|
16
|
+
password: Password for login.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
Return the session object
|
|
20
|
+
"""
|
|
21
|
+
session = Session()
|
|
22
|
+
session.headers.setdefault("Content-Type", "application/json")
|
|
23
|
+
session.auth = HttpNtlmAuth(username, password)
|
|
24
|
+
return session
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def upload_document(*, apiurl: str, file: bytearray, case_id: str, filename: str, agent_name: str | None = None, date_string: str | None = None, session: Session, doc_category: str | None = None, case_type: str = Literal["EMN", "GEO"], overwrite: bool = True) -> tuple[str, Session]:
|
|
28
|
+
"""Upload a document to Get Organized.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
apiurl: Base url for API.
|
|
32
|
+
session: Session token for request.
|
|
33
|
+
file: Bytearray of file to upload.
|
|
34
|
+
case_id: Case ID already present in GO.
|
|
35
|
+
filename: Name of file when saved in GO.
|
|
36
|
+
agent_name: Agent name, used for creating a folder in GO. Defaults to None.
|
|
37
|
+
date_string: A date to add as metadata to GetOrganized. Defaults to None.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
Return response text.
|
|
41
|
+
"""
|
|
42
|
+
url = apiurl + "/_goapi/Documents/AddToCase"
|
|
43
|
+
payload = {
|
|
44
|
+
"Bytes": list(file),
|
|
45
|
+
"CaseId": case_id,
|
|
46
|
+
"SiteUrl": urljoin(apiurl, f"/case{case_type}/{case_id}"),
|
|
47
|
+
"ListName": "Dokumenter",
|
|
48
|
+
"FolderPath": agent_name,
|
|
49
|
+
"FileName": filename,
|
|
50
|
+
"Metadata": f"<z:row xmlns:z='#RowsetSchema' ows_Dato='{date_string}' ows_Kategori='{doc_category}'/>",
|
|
51
|
+
"Overwrite": overwrite
|
|
52
|
+
}
|
|
53
|
+
response = session.post(url, data=json.dumps(payload), timeout=60)
|
|
54
|
+
response.raise_for_status()
|
|
55
|
+
return response.text
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def delete_document(apiurl: str, document_id: int, session: Session) -> tuple[str, Session]:
|
|
59
|
+
"""Delete a document from GetOrganized.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
apiurl: Url of the GetOrganized API.
|
|
63
|
+
session: Session object used for logging in.
|
|
64
|
+
document_id: ID of the document to delete.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Return the response.
|
|
68
|
+
"""
|
|
69
|
+
url = urljoin(apiurl, "/_goapi/Documents/ByDocumentId/")
|
|
70
|
+
payload = {
|
|
71
|
+
"DocId": document_id,
|
|
72
|
+
"ForceDelete": True
|
|
73
|
+
}
|
|
74
|
+
response = session.delete(url, timeout=60, data=json.dumps(payload))
|
|
75
|
+
response.raise_for_status()
|
|
76
|
+
return response
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def create_case(session: Session, apiurl: str, title: str, category: str, department: str, kle: str, case_type: str = Literal["EMN", "GEO"]) -> str:
|
|
80
|
+
"""Create a case in GetOrganized.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
apiurl: Url for the GetOrganized API.
|
|
84
|
+
session: Session object to access API.
|
|
85
|
+
title: Title of the case being created.
|
|
86
|
+
category: Case category to create the case for.
|
|
87
|
+
department: Department for the case.
|
|
88
|
+
kle: KLE number for the case (https://www.kle-online.dk/emneplan/00/)
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Return the caseID of the created case.
|
|
92
|
+
"""
|
|
93
|
+
url = urljoin(apiurl, "/_goapi/Cases/")
|
|
94
|
+
payload = {
|
|
95
|
+
'CaseTypePrefix': case_type,
|
|
96
|
+
'MetadataXml': f'''<z:row xmlns:z="#RowsetSchema"
|
|
97
|
+
ows_Title="{title}"
|
|
98
|
+
ows_CaseStatus="Åben"
|
|
99
|
+
ows_CaseCategory="{category}"
|
|
100
|
+
ows_Afdeling="{department}"
|
|
101
|
+
ows_KLENummer="{kle}"/>''',
|
|
102
|
+
'ReturnWhenCaseFullyCreated': False
|
|
103
|
+
}
|
|
104
|
+
response = session.post(url, data=json.dumps(payload), timeout=60)
|
|
105
|
+
response.raise_for_status()
|
|
106
|
+
return response.json()["CaseID"]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def get_case_metadata(session: Session, apiurl: str, case_id: str) -> str:
|
|
110
|
+
"""Get metadata for a GetOrganized case, to look through parameters and values.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
session: Session token.
|
|
114
|
+
apiurl: Base URL for the API.
|
|
115
|
+
case_id: Case ID to get metadata on.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Return the metadata for the case as an XML string.
|
|
119
|
+
"""
|
|
120
|
+
url = urljoin(apiurl, f"/_goapi/Cases/Metadata/{case_id}")
|
|
121
|
+
response = session.get(url, timeout=60)
|
|
122
|
+
response.raise_for_status()
|
|
123
|
+
return response.json()["Metadata"]
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def find_case(session: Session, apiurl: str, case_title: str, case_type: str = Literal["EMN", "GEO"]) -> list[str]:
|
|
127
|
+
"""Search for an existing case in GO with the given case title.
|
|
128
|
+
The search finds any case that contains the given title in its title.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
case_title: The title to search for.
|
|
132
|
+
session: Session object to access the API.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
The case id of the found case(s) if any.
|
|
136
|
+
"""
|
|
137
|
+
url = apiurl + "/_goapi/Cases/FindByCaseProperties"
|
|
138
|
+
payload = {
|
|
139
|
+
"FieldProperties": [
|
|
140
|
+
{
|
|
141
|
+
"InternalName": "ows_Title",
|
|
142
|
+
"Value": case_title,
|
|
143
|
+
"ComparisonType": "Contains",
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"CaseTypePrefixes": [case_type],
|
|
147
|
+
"LogicalOperator": "AND",
|
|
148
|
+
"ExcludeDeletedCases": True
|
|
149
|
+
}
|
|
150
|
+
response = session.post(url, data=json.dumps(payload), timeout=60)
|
|
151
|
+
response.raise_for_status()
|
|
152
|
+
cases = response.json()['CasesInfo']
|
|
153
|
+
|
|
154
|
+
return [case['CaseID'] for case in cases]
|
|
@@ -10,7 +10,7 @@ def open_forretningspartner(session, fp: str) -> None:
|
|
|
10
10
|
fp: The forretningspartner number.
|
|
11
11
|
|
|
12
12
|
Raises:
|
|
13
|
-
|
|
13
|
+
LookupError: If the forretningspartner wasn't found.
|
|
14
14
|
"""
|
|
15
15
|
session.StartTransaction('fmcacov')
|
|
16
16
|
|
|
@@ -18,10 +18,18 @@ def open_forretningspartner(session, fp: str) -> None:
|
|
|
18
18
|
session.findById("wnd[0]/usr/ctxtGPART_DYN").text = fp
|
|
19
19
|
session.findById("wnd[0]").sendVKey(0)
|
|
20
20
|
|
|
21
|
-
# Detect
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
# Detect popup
|
|
22
|
+
popup = session.findById('wnd[1]', False)
|
|
23
|
+
|
|
24
|
+
# Inactive FP popup
|
|
25
|
+
if popup and popup.Text == "BP inactive":
|
|
26
|
+
# Click 'OK'
|
|
27
|
+
session.FindById("wnd[1]/tbar[0]/btn[25]").press()
|
|
28
|
+
|
|
29
|
+
# "Forretningspartner 2 Entries" popup
|
|
30
|
+
elif popup and popup.Text == 'Forretningspartner 2 Entries':
|
|
31
|
+
# Look for matching fp number
|
|
32
|
+
for row_id in (3, 4):
|
|
25
33
|
fp_row = session.FindById(f'wnd[1]/usr/lbl[103,{row_id}]')
|
|
26
34
|
if fp_row.text == fp:
|
|
27
35
|
fp_row.SetFocus()
|
|
@@ -29,8 +37,7 @@ def open_forretningspartner(session, fp: str) -> None:
|
|
|
29
37
|
session.FindById('wnd[1]/tbar[0]/btn[0]').press()
|
|
30
38
|
break
|
|
31
39
|
else:
|
|
32
|
-
|
|
33
|
-
raise ValueError(f"Forretningspartner '{fp}' was not found in pop-up.")
|
|
40
|
+
raise LookupError(f"Forretningspartner '{fp}' was not found in pop-up.")
|
|
34
41
|
|
|
35
42
|
|
|
36
43
|
def dismiss_key_popup(session, fp: str = "25564617") -> None:
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itk_dev_shared_components
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.12.1
|
|
4
4
|
Summary: Shared components to use in RPA projects
|
|
5
5
|
Author-email: ITK Development <itk-rpa@mkb.aarhus.dk>
|
|
6
6
|
Project-URL: Homepage, https://github.com/itk-dev-rpa/itk-dev-shared-components
|
|
@@ -17,6 +17,7 @@ Requires-Dist: requests==2.*
|
|
|
17
17
|
Requires-Dist: beautifulsoup4==4.*
|
|
18
18
|
Requires-Dist: selenium==4.*
|
|
19
19
|
Requires-Dist: uiautomation==2.*
|
|
20
|
+
Requires-Dist: requests_ntlm==1.*
|
|
20
21
|
Provides-Extra: dev
|
|
21
22
|
Requires-Dist: python-dotenv; extra == "dev"
|
|
22
23
|
Requires-Dist: flake8; extra == "dev"
|
|
@@ -12,6 +12,8 @@ itk_dev_shared_components/eflyt/eflyt_case.py
|
|
|
12
12
|
itk_dev_shared_components/eflyt/eflyt_login.py
|
|
13
13
|
itk_dev_shared_components/eflyt/eflyt_search.py
|
|
14
14
|
itk_dev_shared_components/eflyt/eflyt_util.py
|
|
15
|
+
itk_dev_shared_components/getorganized/__init__.py
|
|
16
|
+
itk_dev_shared_components/getorganized/go_api.py
|
|
15
17
|
itk_dev_shared_components/graph/__init__.py
|
|
16
18
|
itk_dev_shared_components/graph/authentication.py
|
|
17
19
|
itk_dev_shared_components/graph/common.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "itk_dev_shared_components"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.12.1"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="ITK Development", email="itk-rpa@mkb.aarhus.dk" },
|
|
10
10
|
]
|
|
@@ -22,7 +22,8 @@ dependencies = [
|
|
|
22
22
|
"requests == 2.*",
|
|
23
23
|
"beautifulsoup4 == 4.*",
|
|
24
24
|
"selenium == 4.*",
|
|
25
|
-
"uiautomation == 2.*"
|
|
25
|
+
"uiautomation == 2.*",
|
|
26
|
+
"requests_ntlm == 1.*"
|
|
26
27
|
]
|
|
27
28
|
|
|
28
29
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|