Skip to content
Snippets Groups Projects
Commit 6eff57f7 authored by matograine's avatar matograine
Browse files

[enh] #390 create show_response()

parent 21483f1d
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>. ...@@ -17,6 +17,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import sys import sys
import click import click
import logging
from datetime import datetime from datetime import datetime
from silkaj import wot, network_tools, constants from silkaj import wot, network_tools, constants
...@@ -69,6 +70,18 @@ async def send_doc_confirmation(document_name): ...@@ -69,6 +70,18 @@ async def send_doc_confirmation(document_name):
sys.exit(constants.SUCCESS_EXIT_STATUS) 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): def convert_time(timestamp, kind):
ts = int(timestamp) ts = int(timestamp)
date = "%Y-%m-%d" date = "%Y-%m-%d"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment