How to use the fcp.node.defaultFCPHost 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 / freesitemgr.py View on Github external
def getChkCalcNode(addr):
    """
    yuck - using a separate node for chk calculation
    """
    parts = addr.split(":")
    nparts = len(parts)
    if nparts == 1:
        chkHost = addr
        chkPort = fcp.node.defaultFCPPort
    elif nparts == 2:
        chkHost = parts[0] or fcp.node.defaultFCPHost
        chkPort = parts[1] or fcp.node.defaultFCPPort
    
    try:
        chkNode = fcp.node.FCPNode(host=chkHost, port=chkPort)
        return chkNode
    except:
        return None
github freenet / pyFreenet / babcom.py View on Github external
True
    """
    import doctest
    tests = doctest.testmod()
    if tests.failed:
        return "☹"*tests.failed + " / " + numtostring(tests.attempted)
    return "^_^ (" + numtostring(tests.attempted) + ")"


if __name__ == "__main__":
    args = parse_args()
    slowtests = args.slowtests
    if args.port:
        fcp.node.defaultFCPPort = args.port
    if args.host:
        fcp.node.defaultFCPHost = args.host
    if args.verbosity:
        fcp.node.defaultVerbosity = int(args.verbosity)
    if args.test:
        print _test()
        sys.exit(0)
    prompt = Babcom()
    prompt.transient = args.transient
    prompt.username = args.user
    prompt.cmdloop('Starting babcom, type help or intro')
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()
github freenet / pyFreenet / fcp / arguments.py View on Github external
def add_default_arguments(parser):
    '''
    Add the default arguments to an argparse parser.
    '''
    parser.add_argument('--version', '-V', action='version',
                        version="%(prog)s " + fcp.node.fcpVersion)
    parser.add_argument('--fcphost', '-H', default=fcp.node.defaultFCPHost,
                        help="""Connect to FCP service at host .
                             (You may also use the environment variable
                              FCP_HOST.)
                             """)
    parser.add_argument('--fcpport', '-P', default=fcp.node.defaultFCPPort,
                        type=int,
                        help="""Connect to FCP service at port .
                             (You may also use the environment variable
                              FCP_PORT.)
                             """)
    parser.add_argument('--timeout', '-t', default=fcp.node.ONE_YEAR,
                        type=timeout_type,
                        help="""Set the timeout, in seconds, for completion.
                             Default one year.
github freenet / pyFreenet / fcp / sitemgr.py View on Github external
"""
        Creates a new SiteMgr object
        
        Keywords:
            - basedir - directory where site records are stored, default ~/.freesitemgr
        """
        self.kw = kw
        self.basedir = kw.get('basedir', defaultBaseDir)
    
        self.conffile = os.path.join(self.basedir, ".config")
        self.logfile = kw.get('logfile', None)
    
        # set defaults
        #print "SiteMgr: kw=%s" % kw
    
        self.fcpHost = kw.get('host', fcp.node.defaultFCPHost)
        self.fcpPort = kw.get('port', fcp.node.defaultFCPPort)
        self.verbosity = kw.get('verbosity', fcp.node.DETAIL)
        self.Verbosity = kw.get('Verbosity', 0)
        self.maxConcurrent = kw.get('maxconcurrent', defaultMaxConcurrent)
        self.priority = kw.get('priority', defaultPriority)
    
        self.chkCalcNode = kw.get('chkCalcNode', None)
        self.maxManifestSizeBytes = kw.get("maxManifestSizeBytes", 
                                           defaultMaxManifestSizeBytes)
        self.maxNumberSeparateFiles = kw.get("maxNumberSeparateFiles", 
                                             defaultMaxNumberSeparateFiles)


        self.index = kw.get('index', 'index.html')
        self.sitemap = kw.get('index', 'sitemap.html')
        self.mtype = kw.get('mtype', 'text/html')