本文整理汇总了Python中twisted.web.server.Request.path方法的典型用法代码示例。如果您正苦于以下问题:Python Request.path方法的具体用法?Python Request.path怎么用?Python Request.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.server.Request
的用法示例。
在下文中一共展示了Request.path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeRequest
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import path [as 别名]
def makeRequest(method, path, post_data=None):
req = Request(FakeChannel(), None)
req.prepath = req.postpath = None
req.method = method
req.path = path
req.content = StringIO(post_data)
resource = site.getChildWithDefault(path, req)
return resource.render(req)
示例2: mk_request
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import path [as 别名]
def mk_request(path=None, headers=None):
request = Request(channel=None, queued=True)
if path:
request.path = path
if headers:
for k, v in headers.items():
request.requestHeaders.addRawHeader(k, v)
return request
示例3: get_request
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import path [as 别名]
def get_request(self, method, uri, clientproto, headers, data, response):
self.transport = response.transport
r = Request(self, False)
r.method = method
r.clientproto = clientproto
r.path = uri
r.client = response.client
r.host = self.host
r.prepath = []
r.postpath = map(unquote, string.split(r.path[1:], "/"))
r.content = StringIO.StringIO(data)
r.transport = response.transport
return r
示例4: getRequest
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import path [as 别名]
def getRequest(method, url):
req = Request(FakeChannel(), None)
req.method = method
req.path = url
return req