pyegeria 0.8.1__py3-none-any.whl → 0.8.3__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.
@@ -28,26 +28,38 @@ from pyegeria import (
28
28
  from pyegeria.my_profile_omvs import MyProfile
29
29
 
30
30
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
31
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
32
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
33
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
34
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
35
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
36
- EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
37
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
38
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
39
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
40
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
41
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
42
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
43
-
44
- def display_to_dos(search_string: str, status_filter: str, server: str, url: str, username: str, user_pass:str,
45
- jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
46
-
31
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
32
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
33
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
34
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
35
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
36
+ )
37
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
38
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
39
+ "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
40
+ )
41
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
42
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
43
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
44
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
45
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
46
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
47
+
48
+
49
+ def display_to_dos(
50
+ search_string: str,
51
+ status_filter: str,
52
+ server: str,
53
+ url: str,
54
+ username: str,
55
+ user_pass: str,
56
+ jupyter: bool = EGERIA_JUPYTER,
57
+ width: int = EGERIA_WIDTH,
58
+ ):
47
59
  m_client = MyProfile(server, url, user_id=username)
48
60
  token = m_client.create_egeria_bearer_token(username, user_pass)
49
61
 
50
- def generate_table(search_string:str = '*') -> Table:
62
+ def generate_table(search_string: str = "*") -> Table:
51
63
  """Make a new table."""
52
64
  table = Table(
53
65
  title=f"Open ToDos for Platform {url} @ {time.asctime()}",
@@ -56,7 +68,7 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
56
68
  show_lines=True,
57
69
  box=box.ROUNDED,
58
70
  caption=f"ToDos for Server '{server}' @ Platform - {url}",
59
- expand=True
71
+ expand=True,
60
72
  )
61
73
 
62
74
  table.add_column("Name")
@@ -70,7 +82,7 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
70
82
  table.add_column("Sponsor")
71
83
  table.add_column("Assigned")
72
84
 
73
- todo_items = m_client.find_to_do(search_string,status = status_filter)
85
+ todo_items = m_client.find_to_do(search_string, status=status_filter)
74
86
 
75
87
  if type(todo_items) is str:
76
88
  name = " "
@@ -82,10 +94,10 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
82
94
 
83
95
  status = " "
84
96
  sponsor = " "
85
- assigned_out = ''
97
+ assigned_out = ""
86
98
  else:
87
99
  for item in todo_items:
88
- guid = item['elementHeader']['guid']
100
+ guid = item["elementHeader"]["guid"]
89
101
  props = item["properties"]
90
102
  name = props["name"]
91
103
  type_name = props.get("toDoType", " ")
@@ -93,12 +105,12 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
93
105
  priority = str(props.get("priority", " "))
94
106
  due = props.get("dueTime", " ")[:-19]
95
107
  completed = props.get("completionTime", " ")[:-10]
96
- status = props.get("toDoStatus", '---')
108
+ status = props.get("toDoStatus", "---")
97
109
 
98
- assigned_out = ''
99
- assigned_actors = item.get("assignedActors",'---')
110
+ assigned_out = ""
111
+ assigned_actors = item.get("assignedActors", "---")
100
112
  if type(assigned_actors) is list:
101
- assigned_md = ''
113
+ assigned_md = ""
102
114
  for actor in assigned_actors:
103
115
  assigned_md += f"* {actor['uniqueName'].split(',')[0]}\n"
104
116
  assigned_out = Markdown(assigned_md)
@@ -112,7 +124,16 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
112
124
  status = f"[red]{status}"
113
125
 
114
126
  table.add_row(
115
- name, type_name, guid, created, priority, due, completed, status, sponsor, assigned_out
127
+ name,
128
+ type_name,
129
+ guid,
130
+ created,
131
+ priority,
132
+ due,
133
+ completed,
134
+ status,
135
+ sponsor,
136
+ assigned_out,
116
137
  )
117
138
 
118
139
  m_client.close_session()
@@ -125,11 +146,13 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
125
146
  # live.update(generate_table())
126
147
  console = Console(width=width, force_terminal=not jupyter)
127
148
  with console.pager():
128
-
129
149
  console.print(generate_table(search_string))
130
150
 
131
-
132
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
151
+ except (
152
+ InvalidParameterException,
153
+ PropertyServerException,
154
+ UserNotAuthorizedException,
155
+ ) as e:
133
156
  print_exception_response(e)
134
157
  except KeyboardInterrupt:
135
158
  pass
@@ -152,12 +175,15 @@ def main():
152
175
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
153
176
  try:
154
177
  search_string = Prompt.ask("Enter the ToDo you are searching for", default="*")
155
- status_filter = Prompt.ask("Enter an optional status filter ['OPEN','IN_PROGRESS','WAITING','COMPLETE',"
156
- "'ABANDONED', 'None']", default=None)
157
- display_to_dos(search_string, status_filter,server, url, userid, user_pass)
178
+ status_filter = Prompt.ask(
179
+ "Enter an optional status filter ['OPEN','IN_PROGRESS','WAITING','COMPLETE',"
180
+ "'ABANDONED', 'None']",
181
+ default=None,
182
+ )
183
+ display_to_dos(search_string, status_filter, server, url, userid, user_pass)
158
184
  except KeyboardInterrupt:
159
185
  pass
160
186
 
161
187
 
162
188
  if __name__ == "__main__":
163
- main()
189
+ main()
@@ -30,22 +30,32 @@ from pyegeria.my_profile_omvs import MyProfile
30
30
 
31
31
  disable_ssl_warnings = True
32
32
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
33
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
34
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
35
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
36
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
37
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
38
- EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
39
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
40
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
41
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
42
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
43
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
44
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '150'))
45
-
46
- def display_my_profile(server: str, url: str, username: str, user_pass:str,
47
- jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
48
-
33
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
34
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
35
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
36
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
37
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
38
+ )
39
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
40
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
41
+ "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
42
+ )
43
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
44
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
45
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
46
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
47
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
48
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
49
+
50
+
51
+ def display_my_profile(
52
+ server: str,
53
+ url: str,
54
+ username: str,
55
+ user_pass: str,
56
+ jupyter: bool = EGERIA_JUPYTER,
57
+ width: int = EGERIA_WIDTH,
58
+ ):
49
59
  try:
50
60
  m_client = MyProfile(server, url, user_id=username, user_pwd=user_pass)
51
61
  token = m_client.create_egeria_bearer_token(username, user_pass)
@@ -56,10 +66,14 @@ def display_my_profile(server: str, url: str, username: str, user_pass:str,
56
66
 
57
67
  console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
58
68
 
59
- profile_props = my_profiles.get('profileProperties','---')
69
+ profile_props = my_profiles.get("profileProperties", "---")
60
70
  name = profile_props["fullName"]
61
- tree = Tree(Panel(f"Profile of {name}",title = "Personal Profile"),
62
- expanded=True,style="bright_white on black", guide_style="bold bright_blue")
71
+ tree = Tree(
72
+ Panel(f"Profile of {name}", title="Personal Profile"),
73
+ expanded=True,
74
+ style="bright_white on black",
75
+ guide_style="bold bright_blue",
76
+ )
63
77
 
64
78
  profile_props_md = f"\n* GUID: {my_profiles['elementHeader']['guid']}\n"
65
79
  if type(profile_props) is dict:
@@ -67,32 +81,39 @@ def display_my_profile(server: str, url: str, username: str, user_pass:str,
67
81
  if type(profile_props[key]) is str:
68
82
  profile_props_md += f"* {key}: {profile_props[key]}\n"
69
83
  elif type(profile_props[key]) is dict:
70
- p_md = '\n* Additional Details:\n'
84
+ p_md = "\n* Additional Details:\n"
71
85
  for k in profile_props[key].keys():
72
86
  p_md += f"\t* {k}: {profile_props[key][k]}\n"
73
87
  profile_props_md += p_md
74
- t1 = tree.add(Panel(Markdown(profile_props_md),title="Profile Properties", expand=False))
75
-
88
+ t1 = tree.add(
89
+ Panel(
90
+ Markdown(profile_props_md), title="Profile Properties", expand=False
91
+ )
92
+ )
76
93
 
77
- id_list_md=""
94
+ id_list_md = ""
78
95
  for identities in my_profiles["userIdentities"]:
79
96
  id_list_md += f"* {identities['userIdentity']['properties']['userId']}\n"
80
97
  t2 = tree.add(Panel(Markdown(id_list_md), title="Identities", expand=False))
81
98
 
82
- contact_methods = my_profiles['contactMethods']
99
+ contact_methods = my_profiles["contactMethods"]
83
100
  for method in contact_methods:
84
- contact = method['properties']
101
+ contact = method["properties"]
85
102
  contact_methods_md = ""
86
103
  for key in contact.keys():
87
104
  contact_methods_md += f"* {key}: {contact[key]}\n"
88
- t3 = tree.add(Panel(Markdown(contact_methods_md), title="Contact Methods", expand=False))
105
+ t3 = tree.add(
106
+ Panel(
107
+ Markdown(contact_methods_md), title="Contact Methods", expand=False
108
+ )
109
+ )
89
110
 
90
111
  my_roles = my_profiles["roles"]
91
112
  table = Table(
92
- title = f" Roles of {name}",
93
- show_lines= True,
113
+ title=f" Roles of {name}",
114
+ show_lines=True,
94
115
  box=box.ROUNDED,
95
- expand= True,
116
+ expand=True,
96
117
  )
97
118
  table.add_column("Role Type")
98
119
  table.add_column("Role")
@@ -100,20 +121,23 @@ def display_my_profile(server: str, url: str, username: str, user_pass:str,
100
121
  for a_role in my_roles:
101
122
  my_role_props = a_role["properties"]
102
123
  role_type = my_role_props["typeName"]
103
- role = my_role_props.get("title"," ")
124
+ role = my_role_props.get("title", " ")
104
125
  role_guid = a_role["elementHeader"]["guid"]
105
- table.add_row(
106
- role_type, role, role_guid
107
- )
108
- t4 = tree.add(Panel(table, title="Roles", expand=False ),expanded=True)
126
+ table.add_row(role_type, role, role_guid)
127
+ t4 = tree.add(Panel(table, title="Roles", expand=False), expanded=True)
109
128
 
110
129
  print(tree)
111
130
 
112
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
131
+ except (
132
+ InvalidParameterException,
133
+ PropertyServerException,
134
+ UserNotAuthorizedException,
135
+ ) as e:
113
136
  print_exception_response(e)
114
137
  finally:
115
138
  m_client.close_session()
116
139
 
140
+
117
141
  def main():
118
142
  parser = argparse.ArgumentParser()
119
143
  parser.add_argument("--server", help="Name of the server to display status for")
@@ -130,5 +154,6 @@ def main():
130
154
 
131
155
  display_my_profile(server, url, userid, user_pass)
132
156
 
157
+
133
158
  if __name__ == "__main__":
134
- main()
159
+ main()
@@ -27,22 +27,32 @@ from pyegeria.my_profile_omvs import MyProfile
27
27
 
28
28
  disable_ssl_warnings = True
29
29
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
30
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
31
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
32
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
33
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
34
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
35
- EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
36
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
37
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
38
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
39
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
40
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
41
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
42
-
43
- def display_my_roles(server: str, url: str, username: str, user_pass:str,
44
- jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
45
-
30
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
31
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
32
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
33
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
34
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
35
+ )
36
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
37
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
38
+ "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
39
+ )
40
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
41
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
42
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
43
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
44
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
45
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
46
+
47
+
48
+ def display_my_roles(
49
+ server: str,
50
+ url: str,
51
+ username: str,
52
+ user_pass: str,
53
+ jupyter: bool = EGERIA_JUPYTER,
54
+ width: int = EGERIA_WIDTH,
55
+ ):
46
56
  m_client = MyProfile(server, url, user_id=username, user_pwd=user_pass)
47
57
  token = m_client.create_egeria_bearer_token(username, user_pass)
48
58
  my_profiles = m_client.get_my_profile()
@@ -59,7 +69,7 @@ def display_my_roles(server: str, url: str, username: str, user_pass:str,
59
69
  show_lines=True,
60
70
  box=box.ROUNDED,
61
71
  caption=f"My Profile from Server '{server}' @ Platform - {url}\n Press 'q' to Quit",
62
- expand=True
72
+ expand=True,
63
73
  )
64
74
 
65
75
  table.add_column("Name")
@@ -81,9 +91,11 @@ def display_my_roles(server: str, url: str, username: str, user_pass:str,
81
91
  else:
82
92
  name = my_profiles["profileProperties"]["fullName"]
83
93
  job_title = my_profiles["profileProperties"]["jobTitle"]
84
- id_list=" "
94
+ id_list = " "
85
95
  for identities in my_profiles["userIdentities"]:
86
- id_list = f"{identities['userIdentity']['properties']['userId']} {id_list}"
96
+ id_list = (
97
+ f"{identities['userIdentity']['properties']['userId']} {id_list}"
98
+ )
87
99
 
88
100
  my_guid = my_profiles["elementHeader"]["guid"]
89
101
 
@@ -91,7 +103,7 @@ def display_my_roles(server: str, url: str, username: str, user_pass:str,
91
103
  for a_role in my_roles:
92
104
  my_role_props = a_role["properties"]
93
105
  role_type = my_role_props["typeName"]
94
- role = my_role_props.get("title"," ")
106
+ role = my_role_props.get("title", " ")
95
107
  role_guid = a_role["elementHeader"]["guid"]
96
108
  table.add_row(
97
109
  name, job_title, str(id_list), my_guid, role_type, role, role_guid
@@ -109,11 +121,15 @@ def display_my_roles(server: str, url: str, username: str, user_pass:str,
109
121
  with console.pager():
110
122
  console.print(generate_table())
111
123
 
112
-
113
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
124
+ except (
125
+ InvalidParameterException,
126
+ PropertyServerException,
127
+ UserNotAuthorizedException,
128
+ ) as e:
114
129
  print_exception_response(e)
115
130
  assert e.related_http_code != "200", "Invalid parameters"
116
131
 
132
+
117
133
  def main():
118
134
  parser = argparse.ArgumentParser()
119
135
  parser.add_argument("--server", help="Name of the server to display status for")
@@ -130,5 +146,6 @@ def main():
130
146
 
131
147
  display_my_roles(server, url, userid, user_pass)
132
148
 
149
+
133
150
  if __name__ == "__main__":
134
- main()
151
+ main()
@@ -26,25 +26,34 @@ from pyegeria import (
26
26
  from pyegeria.my_profile_omvs import MyProfile
27
27
 
28
28
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
29
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
30
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
31
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
32
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
33
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
34
- EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
35
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
36
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
37
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
38
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
39
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
40
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
29
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
30
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
31
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
32
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
33
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
34
+ )
35
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
36
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
37
+ "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
38
+ )
39
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
40
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
41
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
42
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
43
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
44
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
41
45
 
42
46
  disable_ssl_warnings = True
43
47
 
44
48
 
45
- def display_my_todos(server: str, url: str, user: str, user_pass:str,
46
- jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
47
-
49
+ def display_my_todos(
50
+ server: str,
51
+ url: str,
52
+ user: str,
53
+ user_pass: str,
54
+ jupyter: bool = EGERIA_JUPYTER,
55
+ width: int = EGERIA_WIDTH,
56
+ ):
48
57
  console = Console(width=width, force_terminal=not jupyter)
49
58
 
50
59
  m_client = MyProfile(server, url, user_id=user)
@@ -88,8 +97,16 @@ def display_my_todos(server: str, url: str, user: str, user_pass:str,
88
97
  status = f"[red]{status}"
89
98
 
90
99
  table.add_row(
91
- str(identity), name, todo_type_name, todo_guid, created, priority, due,
92
- completed, status, str(assigned_actors)
100
+ str(identity),
101
+ name,
102
+ todo_type_name,
103
+ todo_guid,
104
+ created,
105
+ priority,
106
+ due,
107
+ completed,
108
+ status,
109
+ str(assigned_actors),
93
110
  )
94
111
 
95
112
  def generate_table() -> Table:
@@ -101,7 +118,7 @@ def display_my_todos(server: str, url: str, user: str, user_pass:str,
101
118
  show_lines=True,
102
119
  box=box.ROUNDED,
103
120
  caption=f"ToDos for Server '{server}' @ Platform - {url}",
104
- expand=True
121
+ expand=True,
105
122
  )
106
123
  table.add_column("Actor")
107
124
  table.add_column("ToDo Name")
@@ -115,7 +132,7 @@ def display_my_todos(server: str, url: str, user: str, user_pass:str,
115
132
  table.add_column("Sponsor")
116
133
 
117
134
  my_profile = m_client.get_my_profile()
118
- my_guid = my_profile["elementHeader"].get("guid","---")
135
+ my_guid = my_profile["elementHeader"].get("guid", "---")
119
136
  my_ids = my_profile["userIdentities"]
120
137
  my_title = my_profile["profileProperties"].get("jobTitle", "No Title")
121
138
  user_ids = []
@@ -127,8 +144,8 @@ def display_my_todos(server: str, url: str, user: str, user_pass:str,
127
144
  if type(my_roles) is list:
128
145
  for role in my_roles:
129
146
  role_guid = role["elementHeader"]["guid"]
130
- role_title = role["properties"].get("title","No Title")
131
- add_rows(table,role_guid,role_title)
147
+ role_title = role["properties"].get("title", "No Title")
148
+ add_rows(table, role_guid, role_title)
132
149
 
133
150
  # m_client.close_session()
134
151
  return table
@@ -139,7 +156,11 @@ def display_my_todos(server: str, url: str, user: str, user_pass:str,
139
156
  time.sleep(2)
140
157
  live.update(generate_table())
141
158
 
142
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
159
+ except (
160
+ InvalidParameterException,
161
+ PropertyServerException,
162
+ UserNotAuthorizedException,
163
+ ) as e:
143
164
  print_exception_response(e)
144
165
 
145
166
  except KeyboardInterrupt:
@@ -147,6 +168,7 @@ def display_my_todos(server: str, url: str, user: str, user_pass:str,
147
168
  finally:
148
169
  m_client.close_session()
149
170
 
171
+
150
172
  def main():
151
173
  parser = argparse.ArgumentParser()
152
174
  parser.add_argument("--server", help="Name of the view server to connect to")
@@ -168,4 +190,4 @@ def main():
168
190
 
169
191
 
170
192
  if __name__ == "__main__":
171
- main()
193
+ main()
@@ -25,32 +25,42 @@ from pyegeria._exceptions import (
25
25
  )
26
26
 
27
27
  from pyegeria.my_profile_omvs import MyProfile
28
+
28
29
  disable_ssl_warnings = True
29
30
 
30
31
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
31
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
32
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
33
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
34
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
35
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
36
- EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
37
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
38
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
39
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
40
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
41
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
42
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
43
-
44
-
45
- def display_todos(server: str , url: str, user: str, user_pass:str,
46
- jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
47
-
32
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
33
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
34
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
35
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
36
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
37
+ )
38
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
39
+ EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
40
+ "EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
41
+ )
42
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
43
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
44
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
45
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
46
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
47
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
48
+
49
+
50
+ def display_todos(
51
+ server: str,
52
+ url: str,
53
+ user: str,
54
+ user_pass: str,
55
+ jupyter: bool = EGERIA_JUPYTER,
56
+ width: int = EGERIA_WIDTH,
57
+ ):
48
58
  console = Console(width=width, force_terminal=not jupyter)
49
59
 
50
60
  m_client = MyProfile(server, url, user_id=user)
51
61
  token = m_client.create_egeria_bearer_token(user, user_pass)
52
62
 
53
- def generate_table(search_string:str = '*') -> Table:
63
+ def generate_table(search_string: str = "*") -> Table:
54
64
  """Make a new table."""
55
65
  table = Table(
56
66
  header_style="bright_white on dark_blue",
@@ -60,7 +70,7 @@ def display_todos(server: str , url: str, user: str, user_pass:str,
60
70
  show_lines=True,
61
71
  box=box.ROUNDED,
62
72
  caption=f"ToDos for Server '{server}' @ Platform - {url}",
63
- expand=True
73
+ expand=True,
64
74
  )
65
75
 
66
76
  table.add_column("Name")
@@ -95,7 +105,7 @@ def display_todos(server: str , url: str, user: str, user_pass:str,
95
105
  priority = str(props.get("priority", " "))
96
106
  due = props.get("dueTime", " ")
97
107
  completed = props.get("completionTime", " ")
98
- status = props.get("toDoStatus", '---')
108
+ status = props.get("toDoStatus", "---")
99
109
  # assigned_actors = item["assignedActors"]
100
110
  # sponsor = assigned_actors[0].get("uniqueName", " ")
101
111
  sponsor = "erinoverview"
@@ -119,7 +129,11 @@ def display_todos(server: str , url: str, user: str, user_pass:str,
119
129
  live.update(generate_table())
120
130
  live.console.pager()
121
131
 
122
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
132
+ except (
133
+ InvalidParameterException,
134
+ PropertyServerException,
135
+ UserNotAuthorizedException,
136
+ ) as e:
123
137
  print_exception_response(e)
124
138
  except KeyboardInterrupt:
125
139
  pass
@@ -143,4 +157,4 @@ def main():
143
157
 
144
158
 
145
159
  if __name__ == "__main__":
146
- main()
160
+ main()