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


Python HTTPPluginControl.getThreadConnection方法代码示例

本文整理汇总了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)
开发者ID:DealerDotCom,项目名称:grinder,代码行数:9,代码来源:slowClient.py

示例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))
开发者ID:ahlfors,项目名称:the_grinder,代码行数:48,代码来源:httpg2.py


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