summaryrefslogtreecommitdiff
path: root/examples/telemetry-access.py
blob: 166c8e938c8bf507555af21390d59047846f3440 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usrz/bin/python

#
#How to access Telemetry using python - gamelocker#
#
import gamelocker
vgApiKey = ''
api = gamelocker.Gamelocker(vgApiKey).Vainglory()


# Get telemetry URL for a particular match played by IGN.
def getTelemetryInfo(IGN):
    try:
        matches = api.matches({
            "sort": "-createdAt",
            "filter[playerNames]": IGN,
            "filter[createdAt-start]": "2017-03-10T00:00:00Z",
            "page[limit]": "1"
        })

        if (matches == False):
            print("No Matches found")
        else :
            match = matches[0]
        print('Time Played: ', match.createdAt)
        print('GameMode: ', match.gameMode)
        print(match.assets[0].name, match.assets[0].url)
    except:
        print("Invalid Name")

getTelemetryInfo("IGN")