How to use the fcp.node function in fcp

To help you get started, we’ve selected a few fcp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freenet / pyFreenet / fcp / invertkey.py View on Github external
def main():
    """
    Front end for fcpget utility
    """
    # default job options
    verbosity = node.ERROR
    verbose = False

    parser = create_parser()
    args = parser.parse_args()

    # try to create the node
    try:
        n = node.FCPNode(host=args.fcphost, port=args.fcpport, verbosity=verbosity,
                         logfile=sys.stderr)
    except:
        if verbose:
            traceback.print_exc(file=sys.stderr)
        sys.stderr.write("Failed to connect to FCP service at %s:%s\n" % (args.fcphost, args.fcpport))

    # determine the uri
    if not args.uri:
github freenet / pyFreenet / fcp / arguments.py View on Github external
def timeout_type(time_str):
    '''
    Argparse argument type for timeouts.
    '''
    try:
        return fcp.node.parseTime(time_str)
    except:
        raise argparse.ArgumentTypeError("Invalid timeout: %s" % time_str)
github freenet / pyFreenet / freesitemgr.py View on Github external
opts['chkCalcNode'] = chkNode
        
        if o in ("-r", "--priority"):
            try:
                pri = int(a)
                if pri < 0 or pri > 6:
                    raise hell
            except:
                usage("Invalid priority '%s'" % pri)
            opts['priority'] = int(a)

        if o in ("-f", "--force"):
            force = True

        if o in ("-C", "--cron"):
            opts['verbosity'] = fcp.node.INFO
            opts['Verbosity'] = 1023
            cron = True

    # process command
    if len(args) < 1:
        usage(msg="No command given")

    cmd = args.pop(0)

    if cmd not in [
            'setup','config','init',
            'add',
            'remove',
            'list', 'listall',
            'update',
            'cancel', "help", "cleanup",
github freenet / pyFreenet / freedisk.py View on Github external
def create(self):
        """
        Creates a new config object
        """
        self.xml = XMLFile(root="freedisk")
        root = self.root = self.xml.root
    
        self.fcpHost = fcp.node.defaultFCPHost
        self.fcpPort = fcp.node.defaultFCPPort
        self.fcpVerbosity = fcp.node.defaultVerbosity
        self.mountpoint = defaultMountpoint
    
        self.save()