5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-22 14:00:27 +00:00

fix error handling

This commit is contained in:
Michał Zieliński 2015-11-21 13:37:55 +01:00
parent d5efa03c34
commit 55ec38f776

View File

@ -145,7 +145,7 @@ def get_peers(con, path):
failure += res['result'] failure += res['result']
print('get_peers: getPeers failed with {:s} on {:s}, trying again. {:d} tries remaining.' print('get_peers: getPeers failed with {:s} on {:s}, trying again. {:d} tries remaining.'
.format(failure, path, 4 - i)) .format(failure, path, 2 - i))
i += 1 i += 1
continue continue
else: else:
@ -205,12 +205,10 @@ def send_graph(nodes, edges):
payload = {'data': json_graph, 'mail': your_mail, 'version': 2} payload = {'data': json_graph, 'mail': your_mail, 'version': 2}
r = requests.post(url, data=payload) r = requests.post(url, data=payload)
if r.status_code == requests.codes.ok: if r.content == 'OK':
print('Done!') print('Done!')
else: else:
print('Submission failed with error code {:d}'.format(r.status_code)) print('Error: %s' % r.content)
if __name__ == '__main__': if __name__ == '__main__':
main() main()