本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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()
示例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()]))
示例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)
示例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)
示例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()
示例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)
示例15: __init__
# 需要导入模块: from twisted.web.server import Site [as 别名]
# 或者: from twisted.web.server.Site import __init__ [as 别名]
def __init__(self):
Site.__init__(self, MD5Root())