コード例 #1
0
def main():
    bets_utils.set_logging(logging.INFO)
    if settings.WO_INTERNET:
        url = "file://" + bets_utils.app_path("pages", "ligastavok_live.html")
    else:
        url = "https://www.ligastavok.ru/bets/live"
    # url = 'about:blank'

    driver_path = bets_utils.get_webdriver_path(browser=bets_utils.CHROME)
    options = webdriver.ChromeOptions()
    # options.add_argument('headless')
    # options.add_argument('--no-sandbox')
    # options.add_argument('--disable-dev-shm-usage')
    # options.add_argument("--disable-gpu")
    # options.add_argument("--window-size=1920,1080")
    # options.add_argument("--disable-extensions")
    options.add_argument("--disable-notifications")
    # options.add_argument("--enable-automation")
    # proxy_str = '--proxy-server=http://{0}:{1}'.format(
    #     PROXY_HOST, str(PROXY_PORT))
    # options.add_argument(proxy_str)
    # Ставим запрет на загрузку картинок
    prefs = {"profile.managed_default_content_settings.images": 2}
    options.add_experimental_option("prefs", prefs)

    logging.info(
        f"Старт программы с параметрами driver_path:{driver_path}, url:{url}")
    if os.path.exists(driver_path):
        wd = webdriver.Chrome(
            executable_path=driver_path,
            options=options,
        )
        # LigastavokProbe.execute(wd, url)   # парсер детальных данных
        # LigastavokLive.execute(wd, url)
        disp = Dispatcher()
        ls = LigastavokLive(web_driver=wd, url=url)
        ls.dispatcher = disp

        disp.queue.put(ls)
        disp.start()
        disp.join()

        # ls.start()
        # ls.join()

        # LigastavokEvent.execute(wd, url)
        if wd:
            wd.quit()
    else:
        logging.info("Is not found path to web driver:", driver_path)
        logging.info("Выход из программы")
コード例 #2
0
 def run(self):
     Dispatcher().run()
コード例 #3
0
ファイル: pataca.py プロジェクト: pataca/pataca
# Pataca resource
class Pataca(Resource):
	isLeaf = True

	def render(self, request):
		urilist = request.uri.split('/')

		if urilist[-1] == '':
			del urilist[-1]

		return dispatcher.process(request, urilist[1:])


# Dispatcher
dispatcher = Dispatcher()
dispatcher.loadallmodules()

# Database setup
db.engine = db.createengine()
db.session = db.createsession(db.engine)
db.models.Model.metadata.bind = db.engine
#db.models.Model.metadata.create_all(db.engine)

# Twisted Site
root = Site(Pataca())

reactor.listenTCP(LISTEN_PORT, root)
print 'Listening on http://localhost:%d/' % LISTEN_PORT
reactor.run()
コード例 #4
0
ファイル: main.py プロジェクト: ronpastore/shell_mvc
from core.dispatcher import Dispatcher

if __name__=="__main__":
	d = Dispatcher()
	d.parseOptions()
	d.loadControllers()	
	d.dispatch()
コード例 #5
0
ファイル: turf.py プロジェクト: wkjagt/turf
    r = redis.StrictRedis(host = REDIS_HOST, port = REDIS_PORT, db = REDIS_DB)

    # import plugins in plugin folder
    import_plugins(PLUGIN_LOCATION)

    plugin_container = PluginContainer(r)



    # makes sure we can exit in a clean way
    signal.signal(signal.SIGINT, signal_handler)
    
    
    # the queue to which event objects are pushed
    eventQueue = multiprocessing.JoinableQueue()

    # the "server" (but actually a receiver)
    receiver = Receiver(eventQueue, (HOST, PORT))
    dispatcher = Dispatcher(eventQueue, r, plugin_container)

    receiver.start()
    dispatcher.start()

    # start the web server
    web_server = WebServer((WEB_HOST, WEB_PORT), WebRequestHandler)
    web_server.set_argument('plugin_container', plugin_container)

    web_server.serve_forever()