made keyadders pep8 compliant

master
Kevin Froman 2019-12-19 03:12:56 -06:00
parent 027abd3f13
commit e77e213589
1 changed files with 13 additions and 9 deletions

View File

@ -1,9 +1,12 @@
''' """
Onionr - Private P2P Communication Onionr - Private P2P Communication
add keys (transport and pubkey) add keys (transport and pubkey)
''' """
''' import sys
import logger
from coredb import keydb
"""
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
@ -16,22 +19,23 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
''' """
import sys
import logger
from coredb import keydb
def add_address(): def add_address():
"""Command to add a peer address from either an arg or stdin"""
try: try:
newAddress = sys.argv[2] newAddress = sys.argv[2]
newAddress = newAddress.replace('http:', '').replace('/', '') newAddress = newAddress.replace('http:', '').replace('/', '')
except IndexError: except IndexError:
pass pass
else: else:
logger.info("Adding address: " + logger.colors.underline + newAddress, terminal=True) logger.info("Adding address: " + logger.colors.underline + newAddress,
terminal=True)
if keydb.addkeys.add_address(newAddress): if keydb.addkeys.add_address(newAddress):
logger.info("Successfully added address.", terminal=True) logger.info("Successfully added address.", terminal=True)
else: else:
logger.warn("Unable to add address.", terminal=True) logger.warn("Unable to add address.", terminal=True)
add_address.onionr_help = "Adds a node transport address to the local node list"
add_address.onionr_help = "Adds a node transport address to the node list"