Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove previously stored cookies from Mechanize

Tags:

ruby

mechanize

Is there a method or any other way which I can you use to delete all previously stored cookies in Mechanize? It remembers that I'm logged in which in my case is not a good thing. I should need to log in everytime I connect to the page.

like image 858
Kreeki Avatar asked Aug 17 '11 20:08

Kreeki


1 Answers

After something like

agent = Mechanize.new
agent.get SOMEURL

you can remove all cookies with agent.cookie_jar.clear!, so the next request of the agent will not send any cookies.

like image 147
eugen Avatar answered Oct 03 '22 13:10

eugen