开发者

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

开发者 https://www.devze.com 2022-12-25 05:07 出处:网络
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 ass

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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号