本文整理汇总了Python中twisted.web.server.Request.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Request.__init__方法的具体用法?Python Request.__init__怎么用?Python Request.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.server.Request
的用法示例。
在下文中一共展示了Request.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, counter, method, path, headers, content):
channel = HTTPChannel()
host = IPv4Address(b"TCP", b"127.0.0.1", 80)
channel.makeConnection(StringTransport(hostAddress=host))
Request.__init__(self, channel, False)
# An extra attribute for identifying this fake request
self._counter = counter
# Attributes a Request is supposed to have but we have to set ourselves
# because the base class mixes together too much other logic with the
# code that sets them.
self.prepath = []
self.requestHeaders = headers
self.content = BytesIO(content)
self.requestReceived(method, path, b"HTTP/1.1")
# requestReceived initializes the path attribute for us (but not
# postpath).
self.postpath = list(map(unquote, self.path[1:].split(b'/')))
# Our own notifyFinish / finish state because the inherited
# implementation wants to write confusing stuff to the transport when
# the request gets finished.
self._finished = False
self._finishedChannel = EventChannel()
# Our own state for the response body so we don't have to dig it out of
# the transport.
self._responseBody = b""
示例2: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Request.__init__(self, *args, **kwargs)
self.is_hydrus_client = True
self.hydrus_args = None
self.hydrus_response_context = None
self.hydrus_request_data_usage = 0
示例3: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, site, *args, **kw):
Request.__init__(self, *args, **kw)
self.site = site
self.authenticated_entity = None
self.start_time = 0
global _next_request_seq
self.request_seq = _next_request_seq
_next_request_seq += 1
示例4: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, site, channel, *args, **kw):
Request.__init__(self, channel, *args, **kw)
self.site = site
self._channel = channel # this is used by the tests
self.authenticated_entity = None
self.start_time = 0
# we can't yet create the logcontext, as we don't know the method.
self.logcontext = None
global _next_request_seq
self.request_seq = _next_request_seq
_next_request_seq += 1
# whether an asynchronous request handler has called processing()
self._is_processing = False
# the time when the asynchronous request handler completed its processing
self._processing_finished_time = None
# what time we finished sending the response to the client (or the connection
# dropped)
self.finish_time = None
示例5: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Request.__init__(self, *args, **kwargs)
self._authenticated_callbacks = []
self.__fix_twisted()
self.notify_on_authenticated(self.__store_ip_in_session)
self.notify_on_authenticated(self.__add_sso_session)
示例6: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, site, *args, **kw):
Request.__init__(self, *args, **kw)
self.site = site
self.authenticated_entity = None
self.start_time = 0
示例7: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, *args, **kw):
Request.__init__(self,*args, **kw)
示例8: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, *args, **kw):
Request.__init__(self, *args, **kw)
self.context = Context(self)
示例9: __init__
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import __init__ [as 别名]
def __init__(self, channel, queued):
return Request.__init__(self, channel, queued)