Browse Source

v1.2

pull/4/head
OSinoooO 6 years ago
parent
commit
fba54d34cb
  1. 2
      cookiespool/config.py
  2. 5
      cookiespool/generator.py

2
cookiespool/config.py

@ -28,7 +28,7 @@ TEST_URL_MAP = {
CYCLE = 120 CYCLE = 120
# API地址和端口 # API地址和端口
API_HOST = '127.0.0.1' API_HOST = '127.0.0.2'
API_PORT = 5000 API_PORT = 5000
# 产生器开关,模拟登录添加Cookies # 产生器开关,模拟登录添加Cookies

5
cookiespool/generator.py

@ -1,7 +1,7 @@
import json import json
from selenium import webdriver from selenium import webdriver
from selenium.webdriver import DesiredCapabilities from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.chrome.options import Options from selenium import webdriver
from cookiespool.config import * from cookiespool.config import *
from cookiespool.db import RedisClient from cookiespool.db import RedisClient
from login.weibo.cookies import WeiboCookies from login.weibo.cookies import WeiboCookies
@ -34,8 +34,9 @@ class CookiesGenerator(object):
self.browser = webdriver.PhantomJS(desired_capabilities=caps) self.browser = webdriver.PhantomJS(desired_capabilities=caps)
self.browser.set_window_size(1400, 500) self.browser.set_window_size(1400, 500)
elif BROWSER_TYPE == 'Chrome': elif BROWSER_TYPE == 'Chrome':
chrome_options = Options() chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless') chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
self.browser = webdriver.Chrome(chrome_options=chrome_options) self.browser = webdriver.Chrome(chrome_options=chrome_options)
def new_cookies(self, username, password): def new_cookies(self, username, password):

Loading…
Cancel
Save