Ejemplo n.º 1
0
    def import_league(self, league: League):
        if self.options['leagues'] and league.bhv_id not in self.options[
                'leagues']:
            LOGGER.debug('SKIPPING League: %s (options)', league)
            return

        if league.youth and not self.options['youth']:
            LOGGER.debug('SKIPPING League (youth league): %s', league)
            return

        tree = logic.get_html(league.source_url())

        game_rows = tree.xpath(
            "//table[@class='gametable']/tr[position() > 1]")
        for game_row in game_rows:
            try:
                self.import_game(game_row, league)
            except Exception:
                logging.getLogger('mail').exception("Could not import Game")
Ejemplo n.º 2
0
    def import_league(self, league: League):
        if self.options['leagues'] and league.bhv_id not in self.options[
                'leagues']:
            LOGGER.debug('SKIPPING League: %s (options)', league)
            return

        if league.youth and not self.options['youth']:
            LOGGER.debug('SKIPPING League (youth league): %s', league)
            return

        html = http.get_text(league.source_url())
        dom = parsing.html_dom(html)

        game_rows = parsing.parse_game_rows(dom)
        for game_row in game_rows:
            try:
                self.import_game(game_row, league)
            except Exception:
                logging.getLogger('mail').exception("Could not import Game")