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


Python Site.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, logger_name, config, resource, *args, **kwargs):
     Site.__init__(self, resource, *args, **kwargs)
     if config.captcha_ip_origin_is_x_forwarded:
         self._log_formatter = proxiedLogFormatter
     else:
         self._log_formatter = combinedLogFormatter
     self.access_logger = logging.getLogger(logger_name)
开发者ID:payingattention,项目名称:synapse,代码行数:9,代码来源:homeserver.py

示例2: __init__

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

      ## downloads server -- client grabs patch info from here
      root.putChild('u', VirtualFile('webRoot/downloads/u'))

      ## MOST OF THE BELOW DONT WORK SO ARE COMMENTED OUT

      ## redalert3pc.sake.gamespy.com
      sakeStorageServer = Resource()
      sakeStorageServer.putChild('StorageServer.asmx', StorageServer())
      #root.putChild('SakeStorageServer', sakeStorageServer)

      ## redalert3pc.auth.pubsvs.gamespy.com -- used to auth before reporting results
      authService = Resource()
      authService.putChild('AuthService.asmx', AuthService())
      #root.putChild('AuthService', authService)

      ## redalert3pc.comp.pubsvs.gamespy.com -- used to report match results
      compSvc = Resource()
      compSvc.putChild('competitionservice.asmx', CompetitionService())
      #compSvc.putChild('CompetitionService.asmx', CompetitionService())
      root.putChild('competitionservice', compSvc)
      #root.putChild('CompetitionService', compSvc)

      ## TODO: psweb.gamespy.com -- SOAP service that serves Clan-related requests
      ## TODO: redalert3services.gamespy.com -- HTTP GET requests that serve rank icons
      ## /GetPlayerRankIcon.aspx?gp=fgErop[sap9faZeJJELRac__&pid=<pid of player> retrieves that player's rank icon
      ## /GetPlayerLadderRatings.aspx?gp=fgErop[sap9faZeJJELRac__ retrieves CSV of ladder ratings


      Site.__init__(self, root)
开发者ID:istobran,项目名称:eaEmu,代码行数:34,代码来源:webServices.py

示例3: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, uri, sites=None):
     with log.enter(obj=self) as tm:
         Site.__init__(self, None, timeout=60*60*30)
         self.uri = uri
         self.wsgi = None
         self.xmlrpc = None
         self._search_web_sites(sites)
开发者ID:TigerND,项目名称:dtx-core,代码行数:9,代码来源:site.py

示例4: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, core):
     thread_pool = ThreadPool()
     thread_pool.start()
     reactor.addSystemEventTrigger("after", "shutdown", thread_pool.stop)
     application = get_flask_application(core)
     wsgi_resource = WSGIResource(reactor, thread_pool, application)
     Site.__init__(self, wsgi_resource)
开发者ID:ojii,项目名称:ircbotframework,代码行数:9,代码来源:http.py

示例5: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, *args, **kw):
     self.active_clients = 0
     self.active_requests = set()
     self._max_requests = kw['max_requests']
     del kw['max_requests']
     self._request_count = 0
     self._stopping_deferred = None
     Site.__init__(self, *args, **kw)
开发者ID:david415,项目名称:carml,代码行数:10,代码来源:pastebin.py

示例6: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
    def __init__(self, logger_name, site_tag, config, resource, *args, **kwargs):
        Site.__init__(self, resource, *args, **kwargs)

        self.site_tag = site_tag

        proxied = config.get("x_forwarded", False)
        self.requestFactory = SynapseRequestFactory(self, proxied)
        self.access_logger = logging.getLogger(logger_name)
开发者ID:0-T-0,项目名称:synapse,代码行数:10,代码来源:site.py

示例7: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, firewall):
     self.user = cattivo.config.get("cleaner", "user")
     self.passwd_file = cattivo.config.get("cleaner", "passwd-file")
     checker = FilePasswordDB(self.passwd_file)
     self.realm = CleanerRealm()
     self.portal = Portal(self.realm)
     self.portal.registerChecker(checker)
     self.firewall = firewall
     Site.__init__(self, CleanerResource(self.portal))
     Loggable.__init__(self)
开发者ID:alessandrod,项目名称:cattivo,代码行数:12,代码来源:http.py

示例8: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
    def __init__(self, service_key, service_type, message):

        self._service_key = service_key
        self._service_type = service_type
        self._message = message

        root = self._InitRoot()

        Site.__init__(self, root)

        self.requestFactory = HydrusRequest
开发者ID:sttollgrin,项目名称:hydrus,代码行数:13,代码来源:HydrusServer.py

示例9: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, **kwargs):
     """
     :todo: read config file or pass other settings for things like 
            renderer settings.
     """
     
     root = Resource()
     root.putChild('status', PrinterStatus())
     root.putChild('static', File(static_path))
     root.putChild('deform', File(pkg_resources.resource_filename("deform", "/static")))
     root.putChild('renderer', FetchRendererForm())
     root.putChild('', PrintDocument())
     
     Site.__init__(self, root, **kwargs)
     
     self._connection = cups.Connection()
     self.renderers = self.loadRenderers()
开发者ID:jjmojojjmojo,项目名称:jira-autoprint,代码行数:19,代码来源:__init__.py

示例10: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
    def __init__(self, master):
        self.authorized = {}

        index = IndexResource()
        robot = RobotResource()
        listjs = ListResource()
        status = StatusResource()
        pack = PackResource()
        packs = PacksTxtResource()

        index.factory = robot.factory = listjs.factory = status.factory = pack.factory = self
        self.master = index.master = robot.master = listjs.master = status.master = pack.master = packs.master = master

        Site.__init__(self, EncodingResourceWrapper(index, [GzipEncoderFactory()]))
        index.putChild("robots.txt", robot) # No reason to bother gzipping this
        index.putChild("list.js", EncodingResourceWrapper(listjs, [GzipEncoderFactory()]))
        index.putChild("status", EncodingResourceWrapper(status, [GzipEncoderFactory()]))
        index.putChild("pack", EncodingResourceWrapper(pack, [GzipEncoderFactory()]))
        index.putChild("packs.txt", EncodingResourceWrapper(packs, [GzipEncoderFactory()]))
开发者ID:fullcounter,项目名称:txoffer,代码行数:21,代码来源:txoffer.py

示例11: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
    def __init__(self, root_resource, *args, **kwargs):
        """
        :param castiel_service:
        :param static_path:
        :param template_path:
        """

        static_path = kwargs.pop('static_path', None)
        if static_path:
            root_resource.putChild('static', File(static_path))

        template_path = kwargs.pop('template_path', None)
        if template_path:
            self.__jinja_loader = jinja2.FileSystemLoader(template_path)
            self.jinja_env = jinja2.Environment(
                extensions=['jinja2.ext.with_'],
                loader=self.__jinja_loader,
            )

        Site.__init__(self, root_resource, *args, **kwargs)
开发者ID:hitsl,项目名称:bouser,代码行数:22,代码来源:site.py

示例12: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
    def __init__(self, resources_path, services, logLevel=logging.ERROR,
                 gateway_path='gateway', debug=False):
        """
        @type resources_path: C{str}
        @type services: C{dict}
        @type logLevel: C{int}
        @type gateway_path: C{str}
        @type debug: C{bool}
        """

        # Map ActionScript classes to Python
        register_class(Question, namespace + '.Question')

        # remoting gateway
        gateway = TwistedGateway(services, expose_request=False,
                                 logger=logging, debug=debug)

        # static files
        root = File(resources_path)
        root.putChild(gateway_path, gateway)

        Site.__init__(self, root)
开发者ID:thijstriemstra,项目名称:rtmp-trivia,代码行数:24,代码来源:trivia_plugin.py

示例13: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, *a, **kw):
     self.endpointFunc = kw.pop('endpointFunc', None)
     Site.__init__(self, *a, **kw)
     self.endpointRequestLengths = collections.defaultdict(list)
     self.requestLengths = []
     self._activeRequests = set()
开发者ID:habnabit,项目名称:polecat,代码行数:8,代码来源:polecat.py

示例14: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self, resource, ip, timeout=60 * 60 * 1):
     self.ip = ip
     Site.__init__(self, resource, timeout=timeout)
开发者ID:HiroIshikawa,项目名称:OpenBazaar-Server,代码行数:5,代码来源:openbazaard.py

示例15: __init__

# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
 def __init__(self):
     Site.__init__(self, MD5Root())
开发者ID:alexstaytuned,项目名称:tx-pendrell,代码行数:4,代码来源:md5_server.py


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