Exemplo n.º 1
0
are downloaded. Files are sorted by region and then by patch. Also organizes
match IDs into a pandas DataFrame and saves this as a csv for future reference.
"""

import json
import pandas as pd
import rawpi
from time import sleep
import requests
import os

GOOD_RESPONSE = 200
RATE_LIMIT_RESPONSE = 429
KEY = 'PUT RIOT API KEY HERE'

rawpi.set_api_key(KEY)


# Method Definitions: save_jsons()


def save_jsons(data_frame, region, patch):
    """
    Given a DataFrame with a column, 'match id', obtains the json for each
    match ID and saves it in the appropriate file.

    Keyword arguments:
    data_frame -- DataFrame containing match IDs in 'match id' column
    region -- region matches were played in
    patch -- patch matches were played on
    """
@author: Jacob van Gogh

This script is used to gather end-of-game stats for matches and place them in
a DataFrame, which is saved as a csv. It gathers the number of FULL_AP_ITEMS
(see util) each champ has purchased as well as:
kills, deaths, assists, lane, role, winner, match duration, region, and patch.
"""

import json
import pandas as pd
import rawpi
import os
import util

KEY = "PUT RIOT API KEY HERE"
rawpi.set_api_key(KEY)

SAVE_FILENAME = 'stats.csv'

FULL_AP_ITEMS = util.FULL_AP_ITEMS

REGIONS = util.REGIONS_SHORT
REGION_DICT = util.REGION_DICT
REVERSE_REGION_DICT = util.REVERSE_REGION_DICT
PATCHES = util.PATCHES


# Create dictionaries from codes to names and vice-versa for items and champs.


item_data = rawpi.get_item_list('na').json()['data']
Exemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 21:17:25 2015

@author: Innerfunk
"""

import json
import pandas as pd
import rawpi
from pprint import pprint
from time import sleep
import pickle
import shutil
"""
KEY = "67097ca5-5400-4b53-86d1-fde4a4b4004a"

test_id = 1179606416
test_region = 'eune'

rawpi.set_api_key(KEY)

match = rawpi.get_match(test_region, test_id, includeTimeline=True)
if (match.status_code == 200):
    match_json = match.json()
    with open('json_size_test.txt', 'w') as outfile:
        json.dump(match_json, outfile)

match2 = rawpi.get_match(test_region, test_id, includeTimeline=False)
if (match2.status_code == 200):
    match_json2 = match2.json()
Exemplo n.º 4
0
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 21:17:25 2015

@author: Innerfunk
"""

import json
import pandas as pd
import rawpi
from pprint import pprint
from time import sleep
import pickle
import shutil

"""
KEY = "67097ca5-5400-4b53-86d1-fde4a4b4004a"

test_id = 1179606416
test_region = 'eune'

rawpi.set_api_key(KEY)

match = rawpi.get_match(test_region, test_id, includeTimeline=True)
if (match.status_code == 200):
    match_json = match.json()
    with open('json_size_test.txt', 'w') as outfile:
        json.dump(match_json, outfile)

match2 = rawpi.get_match(test_region, test_id, includeTimeline=False)
if (match2.status_code == 200):