From 1f3f3e38ddf14c4732a228b0efcac9e5e81a8049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Sat, 21 Nov 2015 14:47:51 +0100 Subject: [PATCH 1/5] sendGraph: Fix introductory comment nick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- scripts/sendGraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index 01b166f..0c423a5 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Based on Kubuxu sendGraph script. Requires Python 3, requests and cjdns. +# Based on Kyrias' sendGraph script. Requires Python 3, requests and cjdns. # You can install them using pip: pip3 install cjdns requests ############################################################################### # CONFIG From 3f10aee97f4a86ea6204784bf6bf70f837860497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Sat, 21 Nov 2015 14:49:29 +0100 Subject: [PATCH 2/5] sendGraph: Use .format consistently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- scripts/sendGraph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index 0c423a5..b2425fe 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -88,7 +88,7 @@ def connect(): print('Connecting using default or ~/.cjdnsadmin credentials...') con = cjdns.connectWithAdminInfo() else: - print('Connecting to port %d...' % (cjdns_port)) + print('Connecting to port {:d}...'.format(cjdns_port)) con = cjdns.connect(cjdns_ip, cjdns_port, cjdns_password) print(admin_tools.whoami(con)['IP']) @@ -212,7 +212,7 @@ def send_graph(nodes, edges): if r.content == 'OK': print('Done!') else: - print('Error: %s' % r.content) + print('Error: {:s}'.format(r.content)) if __name__ == '__main__': main() From 4460ffa0c41c79607974ae9cf4ddf17068b7dc6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Sat, 21 Nov 2015 14:49:40 +0100 Subject: [PATCH 3/5] sendGraph: Use r.text for printing error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit r.text contains the decoded content, while r.content contains the raw response. Signed-off-by: Johannes Löthberg --- scripts/sendGraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index b2425fe..f4b9af7 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -212,7 +212,7 @@ def send_graph(nodes, edges): if r.content == 'OK': print('Done!') else: - print('Error: {:s}'.format(r.content)) + print('Error: {:s}'.format(r.text)) if __name__ == '__main__': main() From 1c92a03d4a3dfd7251ff4da34d6a56f2f9306321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Sat, 21 Nov 2015 14:51:18 +0100 Subject: [PATCH 4/5] sendGraph: Don't print IP on every connect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- scripts/sendGraph.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index f4b9af7..9b03d5b 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -91,7 +91,6 @@ def connect(): print('Connecting to port {:d}...'.format(cjdns_port)) con = cjdns.connect(cjdns_ip, cjdns_port, cjdns_password) - print(admin_tools.whoami(con)['IP']) return con except: From 7421ff15d50c2391f933748051a0280749727b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Sat, 21 Nov 2015 14:51:31 +0100 Subject: [PATCH 5/5] sendGraph: Clarify connection failed message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- scripts/sendGraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index 9b03d5b..1c43f2f 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -94,7 +94,7 @@ def connect(): return con except: - print('Failed!') + print('Connection failed!') print(traceback.format_exc()) sys.exit(1)