From dc733a9b45d13ea893dcf1579fd5e2dbfe3cff6d 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 1/2] sendGraph: Use r.text for comparing response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed this use of r.content in previous commit. 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 1c43f2f..763bb36 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -208,7 +208,7 @@ def send_graph(nodes, edges): payload = {'data': json_graph, 'mail': your_mail, 'version': 2} r = requests.post(url, data=payload) - if r.content == 'OK': + if r.text == 'OK': print('Done!') else: print('Error: {:s}'.format(r.text)) From 658102158149363166b94f9cf8f692227f2874c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Sat, 21 Nov 2015 15:11:48 +0100 Subject: [PATCH 2/2] sendGraph: Clarify whether skipping due to timeouts or not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- scripts/sendGraph.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/sendGraph.py b/scripts/sendGraph.py index 763bb36..bfe27a2 100755 --- a/scripts/sendGraph.py +++ b/scripts/sendGraph.py @@ -155,8 +155,11 @@ def get_peers(con, path): break if 'result' not in res or res['result'] != 'peers': - print('get_peers: failed too many times, skipping.') - print(res) + if 'result' in res and res['result'] == 'timeout': + print('get_peers: timed out on final try, skipping.') + else: + print('get_peers: failed too many times, skipping. Last response: {:s}' + .format(str(res))) return peers for peer in res['peers']: