def schedule_api(self): """ 开启API """ app = Flask(__name__) def get_conn(data): if not hasattr(g, 'redis'): g.redis = RedisClient(data) return g.redis @app.route('/') def index(): return '<h2>Welcome to Proxy Pool System</h2>' @app.route('/random') def get_proxy(): """ Get a proxy :return: 随机代理 """ conn = get_conn(self.data) return conn.random() @app.route('/count') def get_counts(data): """ Get the count of proxies :return: 代理池总量 """ conn = get_conn(self.data) return str(conn.count()) app.run(self.data['API_HOST'], self.data['API_PORT'])
def main(): try: s = Scheduler() s.run() app.run() except: main()
def run_server(self): """ 启动 API """ if not ENABLE_SERVER: logger.info('API 未启动') return app.run(host=API_HOST, port=API_PORT, threaded=API_THREADED)
def schedule_api(self): """ 开启AIP """ print('*'*50) print('开启API...') print('*'*50) app.run(API_HOST, API_PORT)
def main(): # db = redis.Redis(host=HOST, port=PORT) # db.flushall() conn = RedisClient() conn.flush() s = Schedule() s.run() app.run(host=FLASK_HOST, port=FLASK_PORT, debug=True)
def main(): """ 程序入口,运行程序 :return: """ # 实例化调度器 s = Schedule() # 运行调度器 s.run() # 运行flask实例 app.run()
def schedule_api(self): """ 开启API """ app.run()
def main(): try: app.run(API_HOST, API_PORT) except: main()
def schedule_api(self): """ 开启API """ app.run(API_HOST, API_PORT,debug=True)
def schedule_api(self): print('开启API') app.run(port=80)
def main(): s = Scheduler() s.run() app.run(host=FLASK_HOST, port=FLASK_PORT, debug=True)
def schedule_api(self): app.run(API_HOST, API_PORT)
def schedule_api(self): """ Open API """ app.run(API_HOST, API_PORT)
def main(): #运行一个调度器 s = Schedule() s.run() app.run()
def main(): s = Schedule() s.run() app.run(host='0.0.0.0')
def main(): s = Schedule() s.run() app.run()
def main(): s = Schedule() s.run() # 运行调度器 app.run(debug=True, host='0.0.0.0', port=9090) # 运行flask应用程序
def main(): #Schedule是一个调度器 s = Schedule() #app是一个接口 s.run() app.run()
def schedule_api(self): """ 开启API """ app.run(API_HOST, API_PORT)
def scheduler_api(self): """ 开启API :return: None """ app.run(settings.API_HOST, settings.API_PORT)
def main(): s = Schedule() s.run() app.run(host='0.0.0.0', port=8080, debug=True)
def schedule_api(self): """ 开启API """ app.run(API_HOST, API_PORT) # 开启flask,默认是运行localhost 5555
def schedule_api(self): ''' 开启api :return: ''' app.run()
def scheduler_api(self): ''' 开启API ''' app.run(API_HOST, API_PORT)
def main(): s = Schedule() #调度器 s.run() #运行调度器 app.run() #运行接口
def schedule_api(self): """ 开启API """ print("\033[1;30;42m 开始运行API \033[0m") app.run(API_HOST, API_PORT)
def schedule_api(self): """ 开启API """ app.run(API_HOST, API_PORT, threaded=True)
def schedule_api(self): ''' 开启API :return: ''' app.run(API_HOST,API_PORT)
def api(self): app.run(API_HOST, API_PORT)
def schedule_api(self): """ 开启API :return: """ app.run(API_HOST, API_PORT)
def schedule_api(self): """ 开启API """ app.run(api_host, api_port)