当前位置: 首页>>代码示例>>Python>>正文


Python Resource.__init__方法代码示例

本文整理汇总了Python中twisted.web.resource.Resource.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Resource.__init__方法的具体用法?Python Resource.__init__怎么用?Python Resource.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.web.resource.Resource的用法示例。


在下文中一共展示了Resource.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self):
        Resource.__init__(self)

        log.info('Initializing HttpChannelContainer')

        # Reference to Metastore database.
        self.metastore = None

        # HTTP routing callbacks.
        self.callbacks = {}

        # Connect to Metastore database.
        self.database_connect()

        # Initialize routing engine.
        self.router    = PathRoutingEngine() 
开发者ID:daq-tools,项目名称:kotori,代码行数:18,代码来源:http.py

示例2: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, host, port, path, reactor=reactor):
        """
        @param host: the host of the web server to proxy.
        @type host: C{str}

        @param port: the port of the web server to proxy.
        @type port: C{port}

        @param path: the base path to fetch data from. Note that you shouldn't
            put any trailing slashes in it, it will be added automatically in
            request. For example, if you put B{/foo}, a request on B{/bar} will
            be proxied to B{/foo/bar}.  Any required encoding of special
            characters (such as " " or "/") should have been done already.

        @type path: C{str}
        """
        Resource.__init__(self)
        self.host = host
        self.port = port
        self.path = path
        self.reactor = reactor 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:23,代码来源:proxy.py

示例3: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, host, port, path, reactor=reactor):
        """
        @param host: the host of the web server to proxy.
        @type host: C{str}

        @param port: the port of the web server to proxy.
        @type port: C{port}

        @param path: the base path to fetch data from. Note that you shouldn't
            put any trailing slashes in it, it will be added automatically in
            request. For example, if you put B{/foo}, a request on B{/bar} will
            be proxied to B{/foo/bar}.  Any required encoding of special
            characters (such as " " or "/") should have been done already.

        @type path: C{bytes}
        """
        Resource.__init__(self)
        self.host = host
        self.port = port
        self.path = path
        self.reactor = reactor 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:23,代码来源:proxy.py

示例4: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, factory):
        self.factory = factory
        self.skin = self.factory.skin
        self.skindir = self.factory.skindir

        if not os.path.isdir(self.skindir):
            raise Exception(
                "Directory %s for http skin, %s, does not exist." 
                                       % (self.skindir, self.skin))

        with open(os.path.join(self.skindir, "index.html")) as f:
            text = f.read()

        p = re.compile(r"<!--STARTERR-->.*<!--ENDERR-->", re.DOTALL)
        self.login = re.sub(p, "", text)
        self.err = re.sub(r"<!--STARTERR-->|<!--ENDERR-->", "", text)
        Resource.__init__(self) 
开发者ID:thinkst,项目名称:opencanary,代码行数:19,代码来源:http.py

示例5: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, reactor, timeoutSeconds, becameInactive):
        """
        @param reactor: the reactor
        @timeoutSeconds: the number of seconds considered to mean inactive
        @becameInactive: the method to call (with no arguments) when
            inactivity is reached
        """
        self._reactor = reactor
        self._timeoutSeconds = timeoutSeconds
        self._becameInactive = becameInactive

        if self._timeoutSeconds > 0:
            self._delayedCall = self._reactor.callLater(
                self._timeoutSeconds,
                self._inactivityThresholdReached
            ) 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:18,代码来源:agent.py

示例6: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, dockerAddr=None, dockerPort=None, dockerSocket=None,
            path='', reactor=reactor, config=None):
        """
        A docker proxy resource which knows how to connect to real Docker
        daemon either via socket (dockerSocket specified) or address + port for
        TCP connection (dockerAddr + dockerPort specified).
        """
        if config is None:
            # Try to get the configuration from the default place on the
            # filesystem.
            self.config = PluginConfiguration()
        else:
            self.config = config
        self.config.read_and_parse()
        self.parser = EndpointParser(self.config)
        Resource.__init__(self)
        self.host = dockerAddr
        self.port = dockerPort
        self.socket = dockerSocket
        self.path = path
        self.reactor = reactor
        proxy.ReverseProxyResource.__init__(self, dockerAddr, dockerPort, path, reactor) # NB dockerAddr is not actually used
        self.agent = Agent(reactor) # no connectionpool
        self.client = HTTPClient(self.agent) 
开发者ID:ClusterHQ,项目名称:powerstrip,代码行数:26,代码来源:powerstrip.py

示例7: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, service, noAuthResource, authResourceFactory, callback=None):
        """Create a PerspectiveWrapper.
        
        @type service: C{twisted.cred.service.Service}

        @type noAuthResource: C{Resource}

        @type authResourceFactory: a callable object

        @param authResourceFactory: This should be a function which takes as an
        argument perspective from 'service' and returns a
        C{Resource} instance.

        @param noAuthResource: This parameter is the C{Resource} that is used
        when the user is browsing this site anonymously.  Somewhere accessible
        from this should be a link to 'perspective-init', which will display a
        C{form.FormProcessor} that allows the user to log in.
        """
        warnings.warn("Please use UsernamePasswordWrapper instead", DeprecationWarning, 2)
        Resource.__init__(self)
        self.service = service
        self.noAuthResource = noAuthResource
        self.authResourceFactory = authResourceFactory
        self.callback = callback 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:26,代码来源:guard.py

示例8: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, db):
        Resource.__init__(self)
        self.db = db 
开发者ID:moira-alert,项目名称:worker,代码行数:5,代码来源:redis.py

示例9: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, received):
        self.received = received
        Resource.__init__(self) 
开发者ID:datawire,项目名称:mdk,代码行数:5,代码来源:test_webclients.py

示例10: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, dispatcher, global_tokens):
        Resource.__init__(self)
        self.dispatcher = dispatcher
        self.global_tokens = global_tokens 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:6,代码来源:api.py

示例11: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, websocket_uri, filename):
        Resource.__init__(self)
        self.websocket_uri = websocket_uri
        self.filename = filename 
开发者ID:daq-tools,项目名称:kotori,代码行数:6,代码来源:server.py

示例12: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, api):
        self.started = datetime.now()
        self.api = api
        self.output = api.output
        self.root = Resource()
        self.commands = [name[5:]
                         for name in dir(self) if name.startswith('json_')]
        for route in self.commands:
            self.root.putChild(route, Leaf(
                self, getattr(self, 'json_%s' % route))) 
开发者ID:rstms,项目名称:txTrader,代码行数:12,代码来源:webserver.py

示例13: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, conf, db, agent, clients):
        # type: (AutopushConfig, DatabaseManager, Agent, Dict) -> None
        WebSocketServerFactory.__init__(self, conf.ws_url)
        self.conf = conf
        self.db = db
        self.agent = agent
        self.clients = clients
        self.setProtocolOptions(
            webStatus=False,
            openHandshakeTimeout=5,
            autoPingInterval=conf.auto_ping_interval,
            autoPingTimeout=conf.auto_ping_timeout,
            maxConnections=conf.max_connections,
            closeHandshakeTimeout=conf.close_handshake_timeout,
        ) 
开发者ID:mozilla-services,项目名称:autopush,代码行数:17,代码来源:websocket.py

示例14: __init__

# 需要导入模块: from twisted.web.resource import Resource [as 别名]
# 或者: from twisted.web.resource.Resource import __init__ [as 别名]
def __init__(self, syd):
        Resource.__init__(self)
        self.sydent = syd 
开发者ID:matrix-org,项目名称:sydent,代码行数:5,代码来源:v2_servlet.py


注:本文中的twisted.web.resource.Resource.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。