本文整理汇总了Python中net.grinder.plugin.http.HTTPPluginControl.getThreadConnection方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPPluginControl.getThreadConnection方法的具体用法?Python HTTPPluginControl.getThreadConnection怎么用?Python HTTPPluginControl.getThreadConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.grinder.plugin.http.HTTPPluginControl
的用法示例。
在下文中一共展示了HTTPPluginControl.getThreadConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from net.grinder.plugin.http import HTTPPluginControl [as 别名]
# 或者: from net.grinder.plugin.http.HTTPPluginControl import getThreadConnection [as 别名]
def __call__(self):
c = HTTPPluginControl.getThreadConnection(url)
for baud in rates:
c.setBandwidthLimit(baud)
requests[baud].GET(url)
示例2: doTest
# 需要导入模块: from net.grinder.plugin.http import HTTPPluginControl [as 别名]
# 或者: from net.grinder.plugin.http.HTTPPluginControl import getThreadConnection [as 别名]
def doTest(self, iteration):
if self.basicAuthentication:
connection = HTTPPluginControl.getThreadConnection(self.url)
connection.addBasicAuthorization(self.basicAuthentication[0],
self.basicAuthentication[1],
self.basicAuthentication[2])
grinder.statistics.delayReports = 1
if self.postData:
page = self.request.POST(self.url, self.postData).text
else:
page = self.request.GET(self.url).text
if not page:
error = self.okString
else:
error = self.okString and page.find(self.okString) == -1
if error or logHTML:
if self.test.description:
description = "_%s" % self.test.description
else:
description = ""
filename = grinder.filenameFactory.createFilename(
"page",
"_%d_%.3d%s" % (iteration, self.test.number, description))
file = open(filename, "w")
print >> file, page
file.close()
if error:
grinder.logger.error(
"The 'ok' string ('%s') was not found in the page "
"received. The output has been written to '%s'." %
(self.okString, filename))
if error:
grinder.statistics.forLastTest.success = 0
if self.sleepTime:
grinder.sleep(long(self.sleepTime))