I'll update the code to use res.get_cookies and clean out my messy code.