Skip to content

Commit 6caa686

Browse files
committed
WIP address code review feedback
* Needs verification * needs testing
1 parent 9fa8a72 commit 6caa686

File tree

5 files changed

+15
-19
lines changed

5 files changed

+15
-19
lines changed

libs/aries-basic-controller/aries_basic_controller/aries_controller.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __post_init__(self):
3636
self.admin_url,
3737
self.client_session)
3838

39-
def webhook_server(
39+
def init_webhook_server(
4040
self,
4141
webhook_host: str = None,
4242
webhook_port: int = None,
@@ -58,7 +58,6 @@ def webhook_server(
5858
webhook_base=webhook_base,
5959
is_multitenant=self.is_multitenant)
6060

61-
6261
async def listen_webhooks(self):
6362
try:
6463
await self.webhook_server.listen_webhooks()

libs/aries-basic-controller/aries_basic_controller/aries_controller_base.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ def __post_init__(self):
8989
self.admin_url,
9090
self.client_session)
9191

92-
93-
9492
self.mediation = MediationController(
9593
self.admin_url,
9694
self.client_session)
@@ -123,7 +121,7 @@ def __post_init__(self):
123121
self.client_session
124122
)
125123

126-
def webhook_server(self):
124+
def init_webhook_server(self):
127125
raise NotImplementedError
128126

129127
def update_api_key(self, api_key: str):
@@ -159,8 +157,8 @@ def register_listeners(self, listeners, defaults=True):
159157
basicmessage and present_proof (default is True)
160158
"""
161159
try:
162-
## TODO figure out if we should actually use these defaults
163-
## If so lets do it consistently
160+
# TODO figure out if we should actually use these defaults
161+
# If so lets do it consistently
164162
if defaults:
165163
if self.connections:
166164
pub.subscribe(

libs/aries-basic-controller/aries_basic_controller/aries_tenant_controller.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ def __post_init__(self):
3232

3333
super().__post_init__()
3434

35-
# if self.api_key:
36-
# self.headers.update({"X-API-Key": self.api_key})
37-
3835
if self.tenant_jwt:
3936
self.headers.update(
4037
{'Authorization': 'Bearer ' + self.tenant_jwt,
@@ -43,13 +40,15 @@ def __post_init__(self):
4340
# Update the current client session instantiated in the parent class
4441
self.client_session.headers.update(self.headers)
4542

46-
def webhook_server(self):
43+
def init_webhook_server(self):
4744
raise NotImplementedError(
48-
"Please, use an AriesAgentController to start a webhook server.")
45+
("Please, use an AriesAgentController to start a webhook server\n"
46+
"Webhook server fct is disallowed for tenant controllers."))
4947

5048
def listen_webhooks(self):
5149
raise NotImplementedError(
52-
"Please, use an AriesAgentController to listen to webhooks.")
50+
("Please, use an AriesAgentController to start a webhook server\n"
51+
"Webhook server fct is disallowed for tenant controllers."))
5352

5453
def add_listener(self, listener):
5554
"""Subscribe to a listeners for a topic
@@ -63,13 +62,14 @@ def add_listener(self, listener):
6362
"topic":"topicname" key-value pairs
6463
"""
6564
try:
66-
pub_topic_path = listener['topic']
67-
if self.wallet_id:
68-
pub_topic_path = f"{self.wallet_id}.{pub_topic_path}"
65+
pub_topic_path_base = listener['topic']
66+
pub_topic_path = f"{self.wallet_id}.{pub_topic_path_base}"
6967
print("Subscribing too: " + pub_topic_path)
7068
pub.subscribe(listener["handler"], pub_topic_path)
71-
7269
logger.debug("Lister added for topic : ", pub_topic_path)
70+
except self.wallet_id is "":
71+
logger.error(
72+
"Cannot add listener for empty wallet_id.")
7373
except Exception as exc:
7474
logger.warning(
7575
f"Adding webhooks listener failed! {exc!r} occurred.")

libs/aries-basic-controller/aries_basic_controller/aries_webhook_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AriesWebhookServer:
2424
webhook_base : str
2525
The base url for webhooks (default is "")
2626
is_multitenant : bool
27-
Initialise the multitenant interface (default is False)
27+
Handles a multitenant setup (default is False)
2828
"""
2929

3030
webhook_host: str

libs/aries-basic-controller/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ termcolor
88
pillow
99
qrcode
1010
beautifulsoup4
11-
dataclasses

0 commit comments

Comments
 (0)