Skip to content

Instantly share code, notes, and snippets.

@waprin
Created August 12, 2018 23:21
Show Gist options
  • Save waprin/8a34322e75fc98a9f430fb390b22f131 to your computer and use it in GitHub Desktop.
Save waprin/8a34322e75fc98a9f430fb390b22f131 to your computer and use it in GitHub Desktop.
loading dota matches
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