當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。