How do I print out the cookies that Mechanized has stored?

一个人想着一个人 提交于 2020-01-01 11:21:43

问题


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.

How do I print out all the data stored in the cookies by Mechanize?


回答1:


The agent has a cookies methods.

agent = Mechanize.new
page = agent.get("http://www.google.com/")
agent.cookies
agent.cookies.to_s

The cookies return is a Mechanize::Cookies object



来源:https://stackoverflow.com/questions/2566287/how-do-i-print-out-the-cookies-that-mechanized-has-stored

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!