【问题标题】:How can I get html source from a request using The Grinder如何使用 The Grinder 从请求中获取 html 源代码
【发布时间】:2012-11-22 15:47:20
【问题描述】:

我有以下脚本:

  def page2(self):
  """GET / (request 201)."""
     result = request201.GET('/mypage/', None,
     ( NVPair('Accept', 'image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-   shockwave-flash, */*'), 
     NVPair('Accept-Language', 'en-us'), ))

# here i want to print the html source code from the result

return result

脚本是使用Grinder Proxy 录制的。谢谢。

【问题讨论】:

    标签: python jython grinder


    【解决方案1】:

    添加这一行:

    print result.text
    

    更多详情请参阅http://grinder.sourceforge.net/g3/script-javadoc/HTTPClient/HTTPResponse.html

    【讨论】:

    • 我试过了,但这种方法不适用于所有网站。例如:result = request1.GET("accuweather.com/") 当我调用 result.text 时没有打印任何内容。我错过了什么吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-25
    • 2012-04-22
    • 2010-11-24
    • 1970-01-01
    • 2013-07-24
    • 1970-01-01
    • 2017-12-31
    相关资源
    最近更新 更多