且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Rails 3 - 登录另一个网站并保持cookie在会话中

更新时间:2023-10-28 16:31:28

不要存储代理,只是会话cookie。找到要捕获的Cookie的名称。登录后,从Mechanize cookie jar抓取它,将其存储在会话中,并确保它在每个API请求之前的cookie jar中。

Don't store the agent, just the session cookie. Find the name of the cookie you want to capture. After logging in, grab it from the Mechanize cookie jar, store it in the session, and make sure it's in the cookie jar before every "API request".