Commit d61f7754 by Oleksandr Barabash

health-check fixed

parent 38c6e7a6
...@@ -199,37 +199,39 @@ async def v1_get_health_check(_request: Request) -> Response: ...@@ -199,37 +199,39 @@ async def v1_get_health_check(_request: Request) -> Response:
# key = await KEY_VAULT_CLIENT.create_key("pumpalot") # key = await KEY_VAULT_CLIENT.create_key("pumpalot")
# encrypted_data = await KEY_VAULT_CLIENT.encrypt(key, b"hello") # encrypted_data = await KEY_VAULT_CLIENT.encrypt(key, b"hello")
# decrypted_data = await KEY_VAULT_CLIENT.decrypt(key, encrypted_data) # decrypted_data = await KEY_VAULT_CLIENT.decrypt(key, encrypted_data)
conversation_reference = await BOT.cosmos_client.get_conversation(
"a:1aStwF-2DE5JiwY3D56l6w1tEnb0N13ITGJL3Sj4fwnXwFblV1csv3EOsFEqvqQiKfOCvuaXoKuIpsU47QTnb4Pb_65G89EfgDzzL9EbhTDAi4eq4EG18xQGsjogUhlEo", # conversation_reference = await BOT.cosmos_client.get_conversation(
"d3c0e3f9-060e-43d8-9d64-57fbb51d2003" # "a:1aStwF-2DE5JiwY3D56l6w1tEnb0N13ITGJL3Sj4fwnXwFblV1csv3EOsFEqvqQiKfOCvuaXoKuIpsU47QTnb4Pb_65G89EfgDzzL9EbhTDAi4eq4EG18xQGsjogUhlEo",
) # "d3c0e3f9-060e-43d8-9d64-57fbb51d2003"
conversation_reference.activity_id = '1674824975220' # )
# conversation_reference.activity_id = '1674824975220'
async def cb(turn_context: TurnContext): #
""" callback """ # async def cb(turn_context: TurnContext):
activity = Activity(id='1674825125020', # """ callback """
type=ActivityTypes.message) # activity = Activity(id='1674825125020',
# type=ActivityTypes.message)
activity.attachments = [ #
CardFactory.adaptive_card({ # activity.attachments = [
"type": "AdaptiveCard", # CardFactory.adaptive_card({
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", # "type": "AdaptiveCard",
"version": "1.5", # "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"body": [ # "version": "1.5",
{ # "body": [
"type": "TextBlock", # {
"text": "The card to be purged2", # "type": "TextBlock",
"wrap": True # "text": "The card to be purged2",
} # "wrap": True
] # }
}) # ]
] # })
response = await turn_context.update_activity(activity) # ]
print(f"response: {response}") # response = await turn_context.update_activity(activity)
print(f"activity: {activity}") # print(f"response: {response}")
# print(f"activity: {activity}")
await ADAPTER.continue_conversation(conversation_reference, cb, #
app_config.APP_ID) # await ADAPTER.continue_conversation(conversation_reference, cb,
# app_config.APP_ID)
Log.i(TAG, "v1_health_check::ok") Log.i(TAG, "v1_health_check::ok")
return Response(status=HTTPStatus.OK, content_type="application/json") return Response(status=HTTPStatus.OK, content_type="application/json")
except Exception as e: except Exception as e:
...@@ -289,8 +291,7 @@ async def v1_pa_message(request: Request) -> Response: ...@@ -289,8 +291,7 @@ async def v1_pa_message(request: Request) -> Response:
try: try:
request_text = await request.text() request_text = await request.text()
body = json_loads(request_text, dict()) body = json_loads(request_text, dict())
# Add TTL here! pa_message = PAMessage.get_schema(unknown=EXCLUDE).load(body)
pa_message = PAMessage.get_schema().load(body)
print(f"request body: {body}, pa_message: {pa_message}\r\n") print(f"request body: {body}, pa_message: {pa_message}\r\n")
response = await BOT.send_message(pa_message) response = await BOT.send_message(pa_message)
Log.d(TAG, f"v1_pa_message::notification: '{response}'") Log.d(TAG, f"v1_pa_message::notification: '{response}'")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment