Created
August 12, 2018 23:21
-
-
Save waprin/8a34322e75fc98a9f430fb390b22f131 to your computer and use it in GitHub Desktop.
loading dota matches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import time | |
import requests | |
input_file = open('liquid_matches.json') | |
matches = json.load(input_file) | |
input_file.close() | |
print('Loading {} matches\n'.format(len(matches))) | |
f = open('liquid_match_data.txt', 'w') | |
i = 0 | |
for m in matches: | |
print('requseting match {}'.format(m['match_id'])) | |
r = requests.get('https://api.opendota.com/api/matches/{}'.format(m['match_id'])) | |
f.write(r.text) | |
f.write('\n') | |
print(r.text) | |
time.sleep(5) | |
i += 1 | |
print('processed {} matches'.format(i)) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment