def new_instance(self): """ creates a new browser instance args: None returns: self.dkb_br - instance """ print_debug(self.debug, 'DKBRobo.new_instance()\n') # create browser and cookiestore objects self.dkb_br = mechanicalsoup.StatefulBrowser() dkb_cj = cookielib.LWPCookieJar() self.dkb_br.set_cookiejar = dkb_cj # configure browser self.dkb_br.set_handle_equiv = True self.dkb_br.set_handle_redirect = True self.dkb_br.set_handle_referer = True self.dkb_br.set_handle_robots = False self.dkb_br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 GTB7.1 (.NET CLR 3.5.30729)'), ('Accept-Language', 'en-US,en;q=0.5'), ('Connection', 'keep-alive')] # initialize some cookies to fool dkb dkb_ck = cookielib.Cookie(version=0, name='javascript', value='enabled', port=None, port_specified=False, domain='www.dkb.de', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) dkb_cj.set_cookie(dkb_ck) dkb_ck = cookielib.Cookie(version=0, name='BRSINFO_browserPlugins', value='NPSWF32_25_0_0_127.dll%3B', port=None, port_specified=False, domain='www.dkb.de', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) dkb_cj.set_cookie(dkb_ck) dkb_ck = cookielib.Cookie(version=0, name='BRSINFO_screen', value='width%3D1600%3Bheight%3D900%3BcolorDepth%3D24', port=None, port_specified=False, domain='www.dkb.de', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) dkb_cj.set_cookie(dkb_ck) return self.dkb_br
def toRequest(cuid, doid, uss): cookies.set_cookie( cookiejar.Cookie( version=0, name='BAIDUCUID', value=cuid, port=None, port_specified=None, domain=".baidu.com", domain_specified=None, domain_initial_dot=None, path="/", path_specified=None, secure=None, expires=None, discard=None, comment=None, comment_url=None, rest=None, rfc2109=False, )) cookies.set_cookie( cookiejar.Cookie( version=0, name='BDUSS', value=uss, port=None, port_specified=None, domain=".baidu.com", domain_specified=None, domain_initial_dot=None, path="/", path_specified=None, secure=None, expires=None, discard=None, comment=None, comment_url=None, rest=None, rfc2109=False, )) res1 = s.get('https://ext.baidu.com/api/subscribe/v1/relation/status', cookies=cookies, headers=headers) log.logger.info(res1.text) res = s.get( 'https://ext.baidu.com/api/subscribe/v1/relation/receive?callback=_box_jsonp120&type=media&op_type=add&third_id=' + doid + '&sfrom=dusite&source=dusite_pagelist&store=uid&sid=&position=', cookies=cookies, headers=headers) log.logger.info('doid:' + doid + ',uss:' + uss + '------' + res.text)
def create_cookie(name, value, **kwargs): """Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). """ result = { 'version': 0, 'name': name, 'value': value, 'port': None, 'domain': '', 'path': '/', 'secure': False, 'expires': None, 'discard': True, 'comment': None, 'comment_url': None, 'rest': {'HttpOnly': None}, 'rfc2109': False, } badargs = set(kwargs) - set(result) if badargs: err = 'create_cookie() got unexpected keyword arguments: %s' raise TypeError(err % list(badargs)) result.update(kwargs) result['port_specified'] = bool(result['port']) result['domain_specified'] = bool(result['domain']) result['domain_initial_dot'] = result['domain'].startswith('.') result['path_specified'] = bool(result['path']) return cookielib.Cookie(**result)
def set_cookie(self, name, value): """ Sets a cookie to be passed through with requests. """ cookie_domain = self.extra_environ.get('HTTP_HOST', '.localhost') cookie_domain = cookie_domain.split(':', 1)[0] if '.' not in cookie_domain: cookie_domain = "%s.local" % cookie_domain value = escape_cookie_value(value) cookie = http_cookiejar.Cookie(version=0, name=name, value=value, port=None, port_specified=False, domain=cookie_domain, domain_specified=True, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest=None) self.cookiejar.set_cookie(cookie)
def create_cookie(name, value, httpOnly=None, **kwargs): """Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). """ result = dict( version=0, name=name, value=value, port=None, domain='', path='/', secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': httpOnly}, rfc2109=False, ) badargs = set(kwargs) - set(result) if badargs: err = 'create_cookie() got unexpected keyword arguments: %s' raise TypeError(err % list(badargs)) result.update(kwargs) result['port_specified'] = bool(result['port']) result['domain_specified'] = bool(result['domain']) result['domain_initial_dot'] = result['domain'].startswith('.') result['path_specified'] = bool(result['path']) return cookiejar.Cookie(**result)
def go_to_py_cookie(go_cookie): '''Convert a Go-style JSON-unmarshaled cookie into a Python cookie''' expires = None if go_cookie.get('Expires') is not None: t = pyrfc3339.parse(go_cookie['Expires']) expires = t.timestamp() return cookiejar.Cookie( version=0, name=go_cookie['Name'], value=go_cookie['Value'], port=None, port_specified=False, # Unfortunately Python cookies don't record the original # host that the cookie came from, so we'll just use Domain # for that purpose, and record that the domain was specified, # even though it probably was not. This means that # we won't correctly record the CanonicalHost entry # when writing the cookie file after reading it. domain=go_cookie['Domain'], domain_specified=not go_cookie['HostOnly'], domain_initial_dot=False, path=go_cookie['Path'], path_specified=True, secure=go_cookie['Secure'], expires=expires, discard=False, comment=None, comment_url=None, rest=None, rfc2109=False, )
def patch2localfile(patches, workdir, session_cookie=None): """Convert all patches in local files""" result = [] for patch in patches: # check if it's an url if urlparse(patch).scheme: # Create a Patchwork session cookie if specified cookie_jar = None if session_cookie: domain = patch.rsplit('patch', 1)[0].strip('/').split('/')[-1] cookie = cookiejar.Cookie(0, 'sessionid', session_cookie, None, False, domain, False, False, '/', False, False, None, False, None, None, {}) cookie_jar = cookiejar.CookieJar() cookie_jar.set_cookie(cookie) response = requests.get(patch, cookies=cookie_jar) response.raise_for_status() tmpfile = tempfile.mktemp(dir=workdir) with open(tmpfile, 'wb') as file_handler: file_handler.write(response.content) result.append(tmpfile) else: # it's a local file result.append(patch) return result
def load_ff_sessions(session_filename): cj = cookiejar.CookieJar() if os.path.exists(session_filename): try: f = open(session_filename, 'rb').read() json_data = json.loads(f) except ValueError as e: print('Error parsing session JSON:', str(e)) else: for window in json_data.get('windows', []): for cookie in window.get('cookies', []): pprint.pprint(cookie) c = cookiejar.Cookie( 0, cookie.get('name', ''), cookie.get('value', ''), None, False, cookie.get('host', ''), cookie.get('host', '').startswith('.'), cookie.get('host', '').startswith('.'), cookie.get('path', ''), False, False, str(int(time.time()) + 3600 * 24 * 7), False, None, None, {}) cj.set_cookie(c) else: print('Session filename does not exist:', session_filename) return cj
def login_third_step(self): print("第三步") """ 提取datr参数,添加到cookiejar :return: """ sent_url = 'https://www.facebook.com' request = Request(url=sent_url, headers=self.headers1) content = self.opener.open(request) tmp_html = content.read().decode("utf-8") # 查找datr datr_re = re.compile('"_js_datr","(.+?)",') # m = re.compile(reg) datr_result = datr_re.findall(tmp_html) datr = '' if datr_result: datr = datr_result[0] self.cj.set_cookie(cookiejar.Cookie( version=0, name='datr', value=datr, port=None, port_specified=False, domain=".facebook.com", domain_specified=True, domain_initial_dot=False, path="/", path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest=None ))
def load_cookies(cookiefile): global cookies try: cookies = cookiejar.MozillaCookieJar(cookiefile) cookies.load() except Exception: import sqlite3 cookies = cookiejar.MozillaCookieJar() con = sqlite3.connect(cookiefile) cur = con.cursor() try: cur.execute("""SELECT host, path, isSecure, expiry, name, value FROM moz_cookies""") for item in cur.fetchall(): c = cookiejar.Cookie( 0, item[4], item[5], None, False, item[0], item[0].startswith('.'), item[0].startswith('.'), item[1], False, item[2], item[3], item[3] == '', None, None, {}, ) cookies.set_cookie(c) except Exception: pass
def login(self, username='', password=''): username = '******' password = '******' self.brower.get('http://vbooking.ctrip.com/ivbk/accounts/login') try: self.brower.find_element_by_xpath( '//*[@id="loginpanel_container"]/div[1]/div[1]/form/dl[1]/dd/input' ).send_keys(username) sleep(2) self.brower.find_element_by_xpath( '//*[@id="loginpanel_container"]/div[1]/div[1]/form/dl[2]/dd/input' ).send_keys(password) self.brower.execute_script( 'Object.defineProperties(navigator,{webdriver:{get:() => false}});' ) status = self.brower.execute_script('window.navigator.webdriver') sleep(2) button = self.brower.find_element_by_xpath( '//*[@id="verification-code"]/div[1]/div[2]') action = ActionChains(self.brower) action.click_and_hold( button).perform() # perform()用来执行ActionChains中存储的行为 action.reset_actions() action.move_by_offset(140, 0).perform() sleep(0.2) action.move_by_offset(140, 0).perform() self.brower.find_element_by_xpath( '//*[@id="loginpanel_container"]/div[1]/div[1]/form/button' ).click() sleep(1) # 登录逻辑中保存session for cookie in self.brower.get_cookies(): self.session.cookies.set_cookie( cookielib.Cookie(version=0, name=cookie['name'], value=cookie['value'], port='80', port_specified=False, domain=cookie['domain'], domain_specified=True, domain_initial_dot=False, path=cookie['path'], path_specified=True, secure=cookie['secure'], rest={}, expires=cookie['expiry'] if "expiry" in cookie else None, discard=False, comment=None, comment_url=None, rfc2109=False)) self.session.cookies.save() return True except Exception as e: print("登录失败", e) return False
def login_with_qr_code(self): """ 扫描二维码登陆 :return: """ self.cookies = cookiejar.CookieJar() cookies = cookiejar.Cookie(version=0, name='_qz_referrer', value='qzone.qq.com', port=None, port_specified=False, domain='qq.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) self.cookies.set_cookie(cookies) self.headers['host'] = 'ssl.ptlogin2.qq.com' self.headers['referer'] = 'https://qzone.qq.com/' start_time = util.date_to_millis(datetime.datetime.utcnow()) wait_time = 0 login_url = 'https://ssl.ptlogin2.qq.com/ptqrshow?appid=549000912&e=2&l=M&s=3&d=72&v=4&t=0.{0}6252926{1}2285{2}86&daid=5'.format( random.randint(0, 9), random.randint(0, 9), random.randint(0, 9)) while wait_time < 100: wait_time += 1 qr_res = self.req.get(url=login_url, headers=self.headers) self.save_image_concurrent(qr_res.content, self.QR_CODE_PATH) self.cookies = qr_res.cookies login_sig = self.get_cookie('pt_login_sig') qr_sig = self.get_cookie('qrsig') if self.debug: print("success to download qr code") logging.info("success to download qr code") while True: self.headers['referer'] = self.qzone_login_url res = self.req.get( 'https://ssl.ptlogin2.qq.com/ptqrlogin?u1=https%3A%2F%2Fqzs.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&ptqrtoken={0}&ptredirect=0&h=1&t=1&g=1&from_ui=1&ptlang=2052&action=0-0-{1}&js_ver=10220&js_type=1&login_sig={2}&pt_uistyle=40&aid=549000912&daid=5&'.format( self.get_qr_token(qr_sig), util.date_to_millis(datetime.datetime.utcnow()) - start_time, login_sig), headers=self.headers).content.decode("utf-8") ret = res.split("'") if ret[1] == '65' or ret[1] == '0': # 65: QRCode 失效, 0: 验证成功, 66: 未失效, 67: 验证中 break time.sleep(2) if ret[1] == '0': break if ret[1] != '0': self.format_error("Failed to login with qr code") raise ValueError logging.info("scan qr code success") # 删除QRCode文件 if os.path.exists(self.QR_CODE_PATH + '.jpg'): os.remove(self.QR_CODE_PATH + '.jpg') self.nickname = ret[11] cookie = '' for elem in self.cookies: cookie += elem.name + "=" + elem.value + ";" self.cookies = cookie self.get_g_tk() self.headers['cookie'] = self.cookies self.h5_headers['cookie'] = self.cookies print("Login success,", self.username)
def save_cookies_lwp(cookiejar, filename): lwp_cookiejar = cookielib.LWPCookieJar() for c in cookiejar: args = dict(vars(c).items()) args['rest'] = args['_rest'] del args['_rest'] c = cookielib.Cookie(**args) lwp_cookiejar.set_cookie(c) lwp_cookiejar.save(filename, ignore_discard=True)
def set_cookies(dict_cookie, clear=True, alfa_s=False): """ View a specific cookie in cookies.dat @param dict_cookie: dictionary where the cookie parameters are obtained The dict must contain: name: cookie name value: its value / content domain: domain to which the cookie points optional: expires: life time in seconds, if not used add 1 day (86400s) @type dict_cookie: dict @param clear: True = delete cookies from the domain, before adding the new one (necessary for cloudproxy, cp) False = disabled by default, just update the cookie @type clear: bool """ # The cookie will be given a default day of life expires_plus = dict_cookie.get('expires', 86400) ts = int(time.time()) expires = ts + expires_plus name = dict_cookie.get('name', '') value = dict_cookie.get('value', '') domain = dict_cookie.get('domain', '') # We delete existing cookies in that domain (cp) if clear: try: cj.clear(domain) except: pass ck = cookielib.Cookie(version=0, name=name, value=value, port=None, port_specified=False, domain=domain, domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=expires, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) cj.set_cookie(ck) save_cookies()
def set_cookies(dict_cookie, clear=True, alfa_s=False): """ Guarda una cookie especifica en cookies.dat @param dict_cookie: diccionario de donde se obtienen los parametros de la cookie El dict debe contener: name: nombre de la cookie value: su valor/contenido domain: dominio al que apunta la cookie opcional: expires: tiempo de vida en segundos, si no se usa agregara 1 dia (86400s) @type dict_cookie: dict @param clear: True = borra las cookies del dominio, antes de agregar la nueva (necesario para cloudproxy, cp) False = desactivado por defecto, solo actualiza la cookie @type clear: bool """ #Se le dara a la cookie un dia de vida por defecto expires_plus = dict_cookie.get('expires', 86400) ts = int(time.time()) expires = ts + expires_plus name = dict_cookie.get('name', '') value = dict_cookie.get('value', '') domain = dict_cookie.get('domain', '') #Borramos las cookies ya existentes en dicho dominio (cp) if clear: try: cj.clear(domain) except: pass ck = cookielib.Cookie(version=0, name=name, value=value, port=None, port_specified=False, domain=domain, domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=expires, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) cj.set_cookie(ck) save_cookies()
def route_set_cookies() -> dict: check_access() if not os.path.isfile(db.get_rootpath()+"/cookies.txt"): return {'status': False} jar = ck.MozillaCookieJar(db.get_rootpath()+"/cookies.txt") jar.load(ignore_discard=True, ignore_expires=True) for c in bottle.request.json["cookies"]: name, value, domain, path, expires = c[0], c[1], c[2], c[3], c[4] #version, name, value, port, port_specified, domain, domain_specified, domain_initial_dot, path, path_specified, secure, expires, discard, comment, comment_url, rest cookie = ck.Cookie(0, name, value, None, False, domain, True, domain.startswith('.'), path, True, False, expires, False, None, None, {}) jar.set_cookie(cookie) jar.save(ignore_discard=True, ignore_expires=True) return {'status': True}
def test_load_cookies_expire_is_none(self): self.session.delete_cookies() jar = cookiejar.CookieJar() cookie = cookiejar.Cookie(version=0, name='Name', value='1', port=None, port_specified=False, domain='www.example.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False) jar.set_cookie(cookie) self.session.load_cookies(jar)
def get_cookies(cj, ff_cookies, filter): con = sqlite3.connect(ff_cookies) cur = con.cursor() cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies") for item in cur.fetchall(): c = cookiejar.Cookie(0, item[4], item[5], None, False, item[0], item[0].startswith('.'), item[0].startswith('.'), item[1], False, item[2], item[3], item[3]=="", None, None, {}) if c.domain.find(filter) != -1: cj.set_cookie(c)
def get_cookies(cj, ff_cookies): con = sqlite3.connect(ff_cookies) cur = con.cursor() cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies") for item in cur.fetchall(): c = cookielib.Cookie(0, item[4], item[5], None, False, item[0], item[0].startswith('.'), item[0].startswith('.'), item[1], False, item[2], item[3], item[3]=="", None, None, {}) print(c) cj.set_cookie(c)
def make_cookie(name, value, domain, path): return cookiejar.Cookie(version=0, name=name, value=value, port=None, port_specified=False, domain=domain, domain_specified=True, domain_initial_dot=False, path=path, path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest=None)
def make_cookiejar(url):#URL来自 check_scan() 成功后的传参 tmpjar = cookiejar.MozillaCookieJar() data = url.split('?')[-1].split('&')[:-1] for domain in ['.bilibili.com','.bigfun.cn','.bigfunapp.cn','.biligame.com']: for item in data: i = item.split('=',1) tmpjar.set_cookie(cookiejar.Cookie( 0,i[0],i[1], None,False, domain,True,domain.startswith('.'), '/',False, False,int(time.time())+(6*30*24*60*60), False, None, None, {} )) return tmpjar
def add_cookie(self, name, value): temp_cookie = ck.Cookie(version=0, name=name, value=value, port=None, port_specified=False, domain=".tsdm39.net", domain_specified=True, domain_initial_dot=False, path="/", path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest={}) self.cookie.set_cookie(temp_cookie)
def cookie_from_dict(data): return cookiejar.Cookie( name=data['name'], value=data['value'], domain=data['domain'], domain_initial_dot=data['domain'].startswith('.'), path=data['path'], expires=int(data['expires']), rest={'HttpOnly': data['http_only']}, secure=data['secure'], version=0, domain_specified=True, port=None, port_specified=False, path_specified=data['path'] != '/', discard=False, comment=None, comment_url=None, )
def make_simple_cookie(domain=None, name=None, value=None): ck = cookielib.Cookie(version=0, name=str(name), value=str(value), port=None, port_specified=False, domain=domain, domain_specified=True, domain_initial_dot=False, path="/", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={"HttpOnly": None}, rfc2109=False) return ck
def __create_cookie(self, data): self.log.trace() return cookiejar.Cookie(version=data["version"], name=data["name"], value=data["value"], port=data["port"], port_specified=data["port_specified"], domain=data["domain"], domain_specified=data["domain_specified"], domain_initial_dot=data["domain_initial_dot"], path=data["path"], path_specified=data["path_specified"], secure=data["secure"], expires=data["expires"], discard=data["discard"], comment=data["comment"], comment_url=data["comment_url"], rest=data["rest"], rfc2109=data["rfc2109"])
def get_cookie_jar(path_to_db: str, domain: str): """ :param path_to_db: the path to the Browsers Cookie sqlite database :param domain: domain of the website that you want to cookies from :return: A CookieJar object """ conn = sqlite3.connect(path_to_db) cur = conn.cursor() # in my own browser (Opera) cookie values are encrypted # if your's is not you can skip using the `main_decryption` function sql = f"SELECT host_key, name, encrypted_value, expires_utc, is_secure, path \ FROM cookies WHERE host_key LIKE '%{domain}%'" query_res = cur.execute(sql) jar = cookiejar.CookieJar() for i, val in enumerate(query_res): host = val[0] name = val[1] value = main_decryption(val[2]) expires_at = val[3] is_secure = val[4] path = val[5] cookie = cookiejar.Cookie(version=0, name=name, value=value, port=None, port_specified=False, domain=host, domain_specified=True, domain_initial_dot=host.startswith('.'), path=path, path_specified=False, secure=is_secure, expires=expires_at, discard=expires_at == '', comment=None, comment_url=None, rest={}) jar.set_cookie(cookie) return jar
def get_session_cookie(auth): return cookiejar.Cookie( name='_simpleauth_sess', value=auth, domain=urlsplit(HB_HOME_URL)[1], path='/', expires=63072000 + int(auth.split('|')[1]), # 63072000 equals 1. January 1972 00:00:00 secure=True, version=0, domain_specified=False, domain_initial_dot=False, path_specified=False, port=None, port_specified=False, discard=False, comment=None, comment_url=None, rest={}, )
def create_cookie(host, path, secure, expires, name, value): """Shortcut function to create a cookie""" return cookielib.Cookie( 0, name, value, None, False, host, host.startswith("."), host.startswith("."), path, True, secure, expires, False, None, None, {}, )
def do_login(driver, username, password): """ Login to cowcow """ print("Logging into cowcow to upload") driver.get(login_url) # Give firefox a few cycles to find the driver title c = 0 while "Login" not in driver.title and c < 10: print("Driver title is: {0}".format(driver.title)) time.sleep(1) c = c+1 assert "Login" in driver.title username_elem = driver.find_element_by_name("tbEmail") username_elem.clear() username_elem.send_keys(username) password_elem = driver.find_element_by_name("tbPassword") password_elem.clear() password_elem.send_keys(password) password_elem.send_keys(Keys.RETURN) time.sleep(5) assert "Login" not in driver.title # Grab the cookie cookie = driver.get_cookies() # Store it in the cookie jar cj = cookielib.LWPCookieJar() for s_cookie in cookie: cj.set_cookie(cookielib.Cookie( version=0, name=s_cookie['name'], value=s_cookie['value'], port='80', port_specified=False, domain=s_cookie['domain'], domain_specified=True, domain_initial_dot=False, path=s_cookie['path'], path_specified=True, secure=s_cookie['secure'], expires=None, discard=False, comment=None, comment_url=None, rest=None, rfc2109=False)) # cj.save("cookies.txt") -- this fails idk why # Instantiate a Browser and set the cookies br = mechanize.Browser() br.set_cookiejar(cj) return br
def load_cookies(self, cookies): cj = cookielib.LWPCookieJar() for cookie in cookies: cj.set_cookie( cookielib.Cookie(version=0, name=cookie['name'], value=cookie['value'], domain=cookie['domain'], domain_specified=True, domain_initial_dot=False, path=cookie['path'], path_specified=True, secure=cookie['secure'], expires=None, comment=None, comment_url=None, rest=None, discard=False, port=None, port_specified=False, rfc2109=False)) self.downloader.add_handler(request.HTTPCookieProcessor(cj))