【发布时间】:2013-06-23 21:34:55
【问题描述】:
我正在并行解析一堆文档,我很想使用异步网络请求来完成。
我尝试将 typhoeus 与 mechanize 集成,但在从 mechanize 传递 cookie 时遇到问题。
我的步骤:
- 通过 mechanize 登录并获取 cookie。
- 将 cookie 传递给 typhoeus 并发送请求。
- 使用 nokogiri 解析响应。
- 重复 2-3 次。
我正在发送请求:
Typhoeus::Request.new("http://example.com", headers: {'Cookie' => agent.cookies})
其中agent 是一个机械化实例。
有没有办法将 Mechanize 与 Eventmachine 或 Typhoeus 集成?
【问题讨论】:
标签: ruby mechanize eventmachine typhoeus