Skip to content

Commit 7a489b7

Browse files
committed
Merge branch 'features/webhooks' of https://github.com/OpenMined/PyDentity into features/webhooks
2 parents ee8262e + 3998f50 commit 7a489b7

File tree

39 files changed

+2413
-2586
lines changed

39 files changed

+2413
-2586
lines changed

libs/aries-basic-controller/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A simple pip installable package for controlling aries agents through admin API
44

55
# Install
66

7-
Current version 0.2
7+
Current version 0.3
88

99
`python3 -m pip install aries_basic_controller`
1010

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def listen_webhooks(self):
6363
await self.webhook_server.listen_webhooks()
6464
logger.info("Webhook server started.")
6565
except AttributeError:
66-
logger.warning("Missing webhook listener.")
66+
logger.warning("Webhook server not initialised.")
6767
except Exception as exc:
6868
logger.warning(
6969
f"Listening webhooks 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
@@ -72,7 +72,7 @@ async def _receive_webhook(self, request: ClientRequest):
7272
wallet_id = None
7373
if self.is_multitenant:
7474
wallet_id = request.match_info["wallet_id"]
75-
print("wallet", wallet_id)
75+
logger.info(f"Received webhook from wallet id: {wallet_id}")
7676
try:
7777
payload = await request.json()
7878
await self._handle_webhook(wallet_id, topic, payload)

libs/aries-basic-controller/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def parse_requirements(filename):
2222
if __name__ == "__main__":
2323
setup(
2424
name=PACKAGE_NAME,
25-
version="0.4",
25+
version="0.3",
2626
author="Will Abramson",
2727
description="A simple python package for controlling an aries agent through the admin-api interface",
2828
long_description=long_description,

projects/aries-fl/hospital/hospital.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class Hospital:
2929

3030
def __init__(self, agent_config, data_location):
3131

32-
self.agent_controller = AriesAgentController(webhook_host=agent_config["webhook_host"],webhook_port=agent_config["webhook_port"], webhook_base=agent_config["webhook_base"], admin_url=agent_config["admin_url"])
32+
self.agent_controller = AriesAgentController(admin_url=agent_config["admin_url"])
3333

34+
self.agent_controller.init_webhook_server(webhook_host=agent_config["webhook_host"],webhook_port=agent_config["webhook_port"],webhook_base=agent_config["webhook_base"])
3435
self._register_agent_listeners()
3536

3637
self.pending_connections = []

projects/aries-fl/notebooks/researcher/researcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ class Researcher:
3838

3939
def __init__(self, agent_config, validation_data_path, model):
4040

41-
self.agent_controller = AriesAgentController(webhook_host=agent_config["webhook_host"],webhook_port=agent_config["webhook_port"], webhook_base=agent_config["webhook_base"], admin_url=agent_config["admin_url"])
42-
41+
self.agent_controller = AriesAgentController(admin_url=agent_config["admin_url"])
42+
self.agent_controller.init_webhook_server(webhook_host=agent_config["webhook_host"],webhook_port=agent_config["webhook_port"],webhook_base=agent_config["webhook_base"])
43+
4344
self._register_agent_listeners()
4445

4546
self.pending_dataowner_connections = []

projects/doctors-in-training/notebooks/gmc/Part 3.1 - Initialising the GMC Agent.ipynb

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@
5454
"import asyncio\n",
5555
"from aries_basic_controller.aries_controller import AriesAgentController\n",
5656
" \n",
57-
"WEBHOOK_HOST = \"0.0.0.0\"\n",
58-
"WEBHOOK_BASE = \"\"\n",
5957
"\n",
60-
"WEBHOOK_PORT = 8032\n",
6158
"ADMIN_URL = \"http://gmc-agent:8031\"\n",
6259
"\n",
6360
"# Based on the aca-py agent you wish to control\n",
64-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
65-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL)"
61+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL)\n",
62+
"\n",
63+
"WEBHOOK_HOST = \"0.0.0.0\"\n",
64+
"WEBHOOK_BASE = \"\"\n",
65+
"\n",
66+
"WEBHOOK_PORT = 8032\n",
67+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
68+
" webhook_base=WEBHOOK_BASE)\n"
6669
]
6770
},
6871
{
@@ -354,8 +357,17 @@
354357
"nbconvert_exporter": "python",
355358
"pygments_lexer": "ipython3",
356359
"version": "3.7.6"
360+
},
361+
"pycharm": {
362+
"stem_cell": {
363+
"cell_type": "raw",
364+
"source": [],
365+
"metadata": {
366+
"collapsed": false
367+
}
368+
}
357369
}
358370
},
359371
"nbformat": 4,
360372
"nbformat_minor": 4
361-
}
373+
}

projects/doctors-in-training/notebooks/gmc/Part 3.2 - Issue GMC Credential .ipynb

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@
3333
"\n",
3434
"from aries_basic_controller.aries_controller import AriesAgentController\n",
3535
" \n",
36-
"WEBHOOK_HOST = \"0.0.0.0\"\n",
37-
"WEBHOOK_PORT = 8032\n",
38-
"WEBHOOK_BASE = \"\"\n",
3936
"ADMIN_URL = \"http://gmc-agent:8031\"\n",
4037
"\n",
4138
"# Based on the aca-py agent you wish to control\n",
42-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
43-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL)\n",
39+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL)\n",
40+
"\n",
41+
"WEBHOOK_HOST = \"0.0.0.0\"\n",
42+
"WEBHOOK_BASE = \"\"\n",
43+
"\n",
44+
"WEBHOOK_PORT = 8032\n",
45+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
46+
" webhook_base=WEBHOOK_BASE)\n",
4447
" "
4548
]
4649
},
@@ -657,8 +660,17 @@
657660
"nbconvert_exporter": "python",
658661
"pygments_lexer": "ipython3",
659662
"version": "3.7.6"
663+
},
664+
"pycharm": {
665+
"stem_cell": {
666+
"cell_type": "raw",
667+
"source": [],
668+
"metadata": {
669+
"collapsed": false
670+
}
671+
}
660672
}
661673
},
662674
"nbformat": 4,
663675
"nbformat_minor": 1
664-
}
676+
}

projects/doctors-in-training/notebooks/hee/Part 4.1 - Initialising the HEE Agent.ipynb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
"ADMIN_URL = \"http://hee-agent:8041\"\n",
4242
"\n",
4343
"# Based on the aca-py agent you wish to control\n",
44-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
45-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL)"
44+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL)\n",
45+
"\n",
46+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
47+
" webhook_base=WEBHOOK_BASE)\n"
4648
]
4749
},
4850
{
@@ -324,8 +326,17 @@
324326
"nbconvert_exporter": "python",
325327
"pygments_lexer": "ipython3",
326328
"version": "3.7.6"
329+
},
330+
"pycharm": {
331+
"stem_cell": {
332+
"cell_type": "raw",
333+
"source": [],
334+
"metadata": {
335+
"collapsed": false
336+
}
337+
}
327338
}
328339
},
329340
"nbformat": 4,
330341
"nbformat_minor": 4
331-
}
342+
}

projects/doctors-in-training/notebooks/hee/Part 4.2 - Interact with Doctor in Training.ipynb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
"ADMIN_URL = \"http://hee-agent:8041\"\n",
4242
"\n",
4343
"# Based on the aca-py agent you wish to control\n",
44-
"agent_controller = AriesAgentController(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
45-
" webhook_base=WEBHOOK_BASE, admin_url=ADMIN_URL)\n",
44+
"agent_controller = AriesAgentController(admin_url=ADMIN_URL)\n",
45+
"\n",
46+
"agent_controller.init_webhook_server(webhook_host=WEBHOOK_HOST, webhook_port=WEBHOOK_PORT,\n",
47+
" webhook_base=WEBHOOK_BASE)\n",
4648
" "
4749
]
4850
},
@@ -683,8 +685,17 @@
683685
"nbconvert_exporter": "python",
684686
"pygments_lexer": "ipython3",
685687
"version": "3.7.6"
688+
},
689+
"pycharm": {
690+
"stem_cell": {
691+
"cell_type": "raw",
692+
"source": [],
693+
"metadata": {
694+
"collapsed": false
695+
}
696+
}
686697
}
687698
},
688699
"nbformat": 4,
689700
"nbformat_minor": 1
690-
}
701+
}

0 commit comments

Comments
 (0)