I use Mechanize to clean a password protected website, as requested by the user. I am trying to decouple the login and search functions by running the Rake task, which logs into the system and saves cookies to a database that is reused by subsequent Mechanize requests.
My problem is that the cookie_jar.save method cookie_jar.save not save cookies / tokens in a cookie. Here is a simple example demonstrating this:
require 'mechanize'
And here is what my saved cookie looks like:
--- www.my-secure-website.com: /: {} /login/: Account: !ruby/object:Mechanize::Cookie version: 0 port: discard: comment_url: expires: Thu, 22 May 2014 07:48:46 GMT max_age: comment: secure: true path: /login/ domain: www.my-secure-website.com accessed_at: 2013-05-22 00:48:47.227628764 -07:00 created_at: 2013-05-22 00:48:47.227628764 -07:00 name: Account value: S4633 for_domain: false domain_name: !ruby/object:DomainName ipaddr: hostname: www.my-secure-website.com uri_host: www.my-secure-website.com tld: com canonical_tld_p: true domain: my-secure-website.com session: false evr.my-secure-website.com: /APBDBQ: {}
You can see the session token ( JSESSIONID ) in the console output, but it is not in the local cookie. My question is: how do I make Mechanize.cookie_jar.save_as also save session data?
source share