コード例 #1
0
def update_results():
    logger.info('Start scraping and updating results')
    matches_results = get_matches_results()
    logger.debug('Number of results: %d', len(matches_results))
    for match_result in matches_results:
        bd.update_results(match_result, match_result.result)
    logger.info('Finish scraping and updating results')
コード例 #2
0
ファイル: bwin_engine.py プロジェクト: ddrm86/bets
def update_results():
    logger.info('Start scraping and updating results')
    matches_results = get_matches_results()
    logger.debug('Number of results: %d', len(matches_results))
    for match_result in matches_results:
        bd.update_results(match_result, match_result.result)
    logger.info('Finish scraping and updating results')
コード例 #3
0
ファイル: bwin_results.py プロジェクト: ddrm86/bets
                logger.info('Scraping competition')
                match_elems = competition_elem.tbody.find_all('tr')
                logger.info('%d matches found', len(match_elems))
                for match_elem in match_elems:
                    name_elem = match_elem.find(class_='name')
                    result_elem = match_elem.find(class_='result')
                    time_elem = match_elem.find(class_='time')
                    local, visitor = _parse_teams(name_elem.text)
                    result = _parse_results(result_elem.text)
                    mtime = _parse_time(time_elem.text)
                    # UTC is used for results, Spain timezone for bets
                    mdatetime = datetime.combine(mdate, mtime) + timedelta(hours=1)
                    match = bd.find_match(str(mdatetime), local, visitor)
                    if not match:
                        logger.warn('Match not found in database: %s, %s, %s', str(mdatetime), local, visitor)
                    else:
                        match.result = result
                        matches.append(match)
        if len(date_elems) == 0:
            finished = True
        page += 1
    logger.info('Finish scraping results')
    return matches


if __name__ == "__main__":
    matches_results = get_matches_results()
    for match_result in matches_results:
        print(match_result, match_result.result)
        bd.update_results(match_result, match_result.result)