undefined method `dump_cookiestxt' for #<Mechanize::CookieJar:0x007fda7c0927f8>
bsgreenb opened this issue · 2 comments
Can you guys describe how to update this type of code? It's not longer possible to use the dump_cookiestxt
and load_cookiestxt
methods
def self.get_cookies(agent)
s = StringIO.new
agent.cookie_jar.dump_cookiestxt(s)
s.string
end
#Load +agent+ with cookies from +cookie_string+
def self.load_cookies(agent, cookie_string)
agent.cookie_jar.load_cookiestxt(StringIO.new(cookie_string)) if !cookie_string.blank?
end
What I used to do was pass around cookies in txt form. How would I rework these functions to be able to do that again?
Try agent.cookie_jar.save(s, :cookiestxt)
and agent.cookie_jar.load(s, :cookiestxt)
instead, which should keep working in the next major release.
I'll fix compatibility issues including this for 2.7.2. Sorry for inconvenience.
Just committed a fix: sparklemotion/mechanize@723bf70
The next minor release of Mechanize will support the removed methods again.
However, the compatibility layer will be removed soon in 2.8 or 2.9, so I recommend switching to save/load.
Thanks!