如何打印机械化存储的Cookie? [英] How do I print out the cookies that Mechanized has stored?
本文介绍了如何打印机械化存储的Cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用机械化功能登录网站,然后检索页面.我遇到了一些问题,我怀疑这是由于Cookie中的某些值引起的.当Mechanize登录到网站时,我假设它存储cookie.
I'm using mechanize to login into a website and then retrieve a page. I'm running into some problems and I suspect this is due to some values in the cookies. When Mechanize logs into a website I assume it stores the cookies.
如何通过Mechanize打印出存储在cookie中的所有数据?
How do I print out all the data stored in the cookies by Mechanize?
推荐答案
代理具有cookie方法.
The agent has a cookies methods.
agent = Mechanize.new
page = agent.get("http://www.google.com/")
agent.cookies
agent.cookies.to_s
返回的Cookie是 Mechanize :: Cookies对象
The cookies return is a Mechanize::Cookies object
这篇关于如何打印机械化存储的Cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文