def _setcookie(cls): "Get the CloudFlare cookie and update security." cookie_header = cls._resp.getheader('Set-Cookie') try: cf_cookie = SimpleCookie(cookie_header)[CF_COOKIE] except (CookieError, KeyError): pass # XXX: with/out previous cookie else: cls._headers['Cookie'] = cf_cookie.OutputString('value') cls._post_headers['Cookie'] = cls._headers['Cookie']