Better printing

This commit is contained in:
Jacob Henry 2019-03-03 20:29:35 -05:00
parent b1d7642dce
commit feb272aeb1
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import asyncio
import json
import sys
import traceback
from pprint import pprint
from typing import List, Any, AsyncGenerator, Dict, Coroutine, TypeVar
from typing import Optional
@ -110,7 +111,8 @@ class ClientWrapper(object):
# Get the payload
post_params = await request.post()
payload = json.loads(post_params["payload"])
print("Interaction received: {}".format(payload))
print("\nInteraction Event received:")
pprint(payload)
# Handle each action separately
if "actions" in payload:
@ -140,6 +142,7 @@ class ClientWrapper(object):
# Respond that everything is fine
return web.Response(status=200)
else:
print("\nMalformed event received.")
# If we can't read it, get mad
return web.Response(status=400)

View File

@ -1,6 +1,7 @@
from __future__ import annotations
from dataclasses import dataclass
from pprint import pprint
from time import sleep
from typing import Optional, Generator, Callable, Union, Awaitable
from typing import TypeVar
@ -158,7 +159,8 @@ def message_stream(slack: SlackClient) -> Generator[Event, None, None]:
# Handle each
for update in update_list:
print("Message received: {}".format(update))
print("\nRTM Message received:")
pprint(update)
yield message_dict_to_event(update)
except (SlackNotConnected, OSError) as e: