|
|
@ -6,6 +6,7 @@ from cookiespool.config import * |
|
|
|
from cookiespool.generator import * |
|
|
|
from cookiespool.generator import * |
|
|
|
from cookiespool.tester import * |
|
|
|
from cookiespool.tester import * |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Scheduler(object): |
|
|
|
class Scheduler(object): |
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def valid_cookie(cycle=CYCLE): |
|
|
|
def valid_cookie(cycle=CYCLE): |
|
|
@ -20,7 +21,7 @@ class Scheduler(object): |
|
|
|
time.sleep(cycle) |
|
|
|
time.sleep(cycle) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print(e.args) |
|
|
|
print(e.args) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def generate_cookie(cycle=CYCLE): |
|
|
|
def generate_cookie(cycle=CYCLE): |
|
|
|
while True: |
|
|
|
while True: |
|
|
@ -34,22 +35,21 @@ class Scheduler(object): |
|
|
|
time.sleep(cycle) |
|
|
|
time.sleep(cycle) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print(e.args) |
|
|
|
print(e.args) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def api(): |
|
|
|
def api(): |
|
|
|
print('API接口开始运行') |
|
|
|
print('API接口开始运行') |
|
|
|
app.run(host=API_HOST, port=API_PORT) |
|
|
|
app.run(host=API_HOST, port=API_PORT) |
|
|
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
def run(self): |
|
|
|
|
|
|
|
if API_PROCESS: |
|
|
|
|
|
|
|
api_process = Process(target=Scheduler.api) |
|
|
|
|
|
|
|
api_process.start() |
|
|
|
|
|
|
|
|
|
|
|
if GENERATOR_PROCESS: |
|
|
|
if GENERATOR_PROCESS: |
|
|
|
generate_process = Process(target=Scheduler.generate_cookie) |
|
|
|
generate_process = Process(target=Scheduler.generate_cookie) |
|
|
|
generate_process.start() |
|
|
|
generate_process.start() |
|
|
|
|
|
|
|
|
|
|
|
if VALID_PROCESS: |
|
|
|
if VALID_PROCESS: |
|
|
|
valid_process = Process(target=Scheduler.valid_cookie) |
|
|
|
valid_process = Process(target=Scheduler.valid_cookie) |
|
|
|
valid_process.start() |
|
|
|
valid_process.start() |
|
|
|
|
|
|
|
|
|
|
|
if API_PROCESS: |
|
|
|
|
|
|
|
api_process = Process(target=Scheduler.api) |
|
|
|
|
|
|
|
api_process.start() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|