diff --git a/silkaj/tui.py b/silkaj/tui.py index 2b09d00f7261902c4598d22b87253b86863f99a6..9651d9c02c1ade39d8712dbf8ee93ff03336e8f0 100644 --- a/silkaj/tui.py +++ b/silkaj/tui.py @@ -17,6 +17,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>. import sys import click +import logging from datetime import datetime from silkaj import wot, network_tools, constants @@ -69,6 +70,18 @@ async def send_doc_confirmation(document_name): sys.exit(constants.SUCCESS_EXIT_STATUS) +async def print_response(response, doc_type): + if response.status == 200: + click.echo(f"{doc_type} successfully sent") + else: + click.echo( + f"Error while publishing {lower(doc_type)}: {0}".format( + await response.text() + ) + ) + logging.debug(await response.text()) + + def convert_time(timestamp, kind): ts = int(timestamp) date = "%Y-%m-%d"