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

Merge pull request #7 from kyrias/sG-fixes

Minor sendGraph fixes
This commit is contained in:
Michał Zieliński 2015-11-21 15:03:24 +01:00
commit 7fd5de8c77

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/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 # You can install them using pip: pip3 install cjdns requests
############################################################################### ###############################################################################
# CONFIG # CONFIG
@ -88,14 +88,13 @@ def connect():
print('Connecting using default or ~/.cjdnsadmin credentials...') print('Connecting using default or ~/.cjdnsadmin credentials...')
con = cjdns.connectWithAdminInfo() con = cjdns.connectWithAdminInfo()
else: 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) con = cjdns.connect(cjdns_ip, cjdns_port, cjdns_password)
print(admin_tools.whoami(con)['IP'])
return con return con
except: except:
print('Failed!') print('Connection failed!')
print(traceback.format_exc()) print(traceback.format_exc())
sys.exit(1) sys.exit(1)
@ -212,7 +211,7 @@ def send_graph(nodes, edges):
if r.content == 'OK': if r.content == 'OK':
print('Done!') print('Done!')
else: else:
print('Error: %s' % r.content) print('Error: {:s}'.format(r.text))
if __name__ == '__main__': if __name__ == '__main__':
main() main()