From fba54d34cb4f308535bffbb539a3ed5c1c54ba19 Mon Sep 17 00:00:00 2001 From: OSinoooO <345285987@qq.com> Date: Sun, 2 Sep 2018 11:06:52 +0800 Subject: [PATCH] v1.2 --- cookiespool/config.py | 2 +- cookiespool/generator.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cookiespool/config.py b/cookiespool/config.py index 167be25..af897d4 100644 --- a/cookiespool/config.py +++ b/cookiespool/config.py @@ -28,7 +28,7 @@ TEST_URL_MAP = { CYCLE = 120 # API地址和端口 -API_HOST = '127.0.0.1' +API_HOST = '127.0.0.2' API_PORT = 5000 # 产生器开关,模拟登录添加Cookies diff --git a/cookiespool/generator.py b/cookiespool/generator.py index cf82abc..a3b73ba 100644 --- a/cookiespool/generator.py +++ b/cookiespool/generator.py @@ -1,7 +1,7 @@ import json from selenium import webdriver from selenium.webdriver import DesiredCapabilities -from selenium.webdriver.chrome.options import Options +from selenium import webdriver from cookiespool.config import * from cookiespool.db import RedisClient from login.weibo.cookies import WeiboCookies @@ -34,8 +34,9 @@ class CookiesGenerator(object): self.browser = webdriver.PhantomJS(desired_capabilities=caps) self.browser.set_window_size(1400, 500) elif BROWSER_TYPE == 'Chrome': - chrome_options = Options() + chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') + chrome_options.add_argument('--disable-gpu') self.browser = webdriver.Chrome(chrome_options=chrome_options) def new_cookies(self, username, password):