<< Back to Warzone Classic Forum   Search

Posts 1 - 6 of 6   
Fizzer's Descent Into Sarcasm: 11/28/2015 15:16:10


Legacy 
Level 56
Report
Further documentation that Fizzer's losing his patience with inane questions!

Fizzer's Descent Into Sarcasm: 11/28/2015 15:28:23


Fleecemaster 
Level 59
Report
Descent? You can't go down if you start at the bottom...
Fizzer's Descent Into Sarcasm: 11/28/2015 15:29:45


ThePop(P)e_(o)(o)
Level 58
Report
really? you did
Fizzer's Descent Into Sarcasm: 11/28/2015 15:35:27


Benjamin628 
Level 60
Report
Well Kasp, Fizzer is actually wrong. You can automate your spreadsheet theoretically, you just need a way to import the ratings parsed from python into excel/google sheets/whatever.

def getLadderTeamData(teamID, timeout=30):
    """
    Returns HTML source for ladder team page
    """
    url = "https://www.warlight.net/LadderTeam?LadderTeamID=" + str(teamID)
    r = requests.get(url=url, timeout=timeout)
    return r.text

def processPoints(dataPointString):
    """
    Given a string of the format [day, rank, rating],
    generates a list of tuples of the format (point #, day, rank, rating)
    """
    pointCounter = 0
    dataPoints = list()
    for item in dataPointString.split("]"):
        pointCounter += 1
        item = str(item)
        item = item.replace("[", "")
        if item[0] == ",": item = item[1:]
        # to get rid of the "," at the beginning of most of these
        pointData = [int(obj) for obj in item.split(",")]
        dataPoints.append((pointCounter, pointData[0], pointData[1],
                           pointData[2]))
    return dataPoints

def getLadderHistory(teamID):
    """
    Given a ladder team ID, gets rating and rank history
    """
    teamData = getLadderTeamData(teamID)
    startPhrase, endPhrase = "Points: [", "]]"
    start = teamData.find(startPhrase) + len(startPhrase)
    teamData = teamData[start:]
    end = teamData.find(endPhrase) - 1
    # -1 because we want that second to last "]" still in
    teamData = teamData[:end]
    return processPoints(teamData)


Edited 11/28/2015 15:39:30
Fizzer's Descent Into Sarcasm: 11/28/2015 17:04:00


Fleecemaster 
Level 59
Report
I think Fizzer was specifically responding to the statememnt about adding this to the API.
Fizzer's Descent Into Sarcasm: 11/28/2015 17:10:44


Nogals
Level 58
Report
LOL @ThePope
Posts 1 - 6 of 6