Example #1
0
def riot_request(region, args):
    # set region
    baseriotapi.set_region(region)

    # extract arguments
    request = args.get("request")
    key = args.get("key")
    match_id = args.get("match_id")
    summoner_id = args.get("summoner_id")
    summoner_ids = args.get("summoner_ids")

    # make request
    if request == 1:
        riot_response = baseriotapi.get_summoners_by_name(format_key(key))
    elif request == 2:
        riot_response = baseriotapi.get_match_list(summoner_id, 0, 0, 0, 0, 0, QUEUE, SEASON)
    elif request == 3:
        riot_response = baseriotapi.get_match(match_id)
    elif request == 4:
        riot_response = baseriotapi.get_leagues_by_summoner(summoner_ids)
    elif request == 5:
        riot_response = baseriotapi.get_ranked_stats(summoner_id, SEASON)
    elif request == 6:
        riot_response = baseriotapi.get_summoner_runes(summoner_id)
    else:
        riot_response = None

    # return response
    return riot_response
Example #2
0
def test_tracking_on_valid_request():
    """Checks that the request tracking works on requests with expected return code of 200"""
    start_count = baseriotapi.get_requests_count()
    int_test_handler.test_result(
        baseriotapi.get_match(int_test_handler.match_id))
    int_test_handler.test_result(
        baseriotapi.get_requests_count() == (start_count[0] + 1,
                                             start_count[1] + 1))
Example #3
0
def scrape_matches(match_db, match_ids, max_chunk):
    current_ids = load_match_ids(match_db)
    to_get = read_match_id_file(match_ids)
    to_get = list(to_get - current_ids)

    matches = []
    while len(to_get) > 0:
        id_ = to_get.pop(0)
        match = baseriotapi.get_match(id_)
        if match:
            matches.append(match)

        if len(matches) >= max_chunk:
            save_matches(match_db, matches, max_chunk)
            matches = []
Example #4
0
def test_tracking_on_valid_request():
    """Checks that the request tracking works on requests with expected return code of 200"""
    start_count = baseriotapi.get_requests_count()
    int_test_handler.test_result(baseriotapi.get_match(int_test_handler.match_id))
    int_test_handler.test_result(baseriotapi.get_requests_count() == (start_count[0] + 1, start_count[1] + 1))
Example #5
0
def test_match():
    int_test_handler.test_result(baseriotapi.get_match(int_test_handler.match_id))