Skip to content

Instantly share code, notes, and snippets.

@TakesxiSximada
Created May 17, 2015 03:01
Show Gist options
  • Save TakesxiSximada/6187c39d7e086cb836e9 to your computer and use it in GitHub Desktop.
Save TakesxiSximada/6187c39d7e086cb836e9 to your computer and use it in GitHub Desktop.
4/25 西武vsソフトバンク
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""4/25 西武/ソフトバンク
"""
import sys
import argparse
import requests
def main(argv=sys.argv[1:]):
parser = argparse.ArgumentParser()
parser.add_argument('domain')
args = parser.parse_args(argv)
url = 'https://{}/packathon/apiv0/dp/data/mashup/pitch_data'.format(args.domain)
params = {
'count': '',
'limit': 20,
# 'sort': 'player_short_name,player_no',
'primary': "team_code eq 2008001",
'target': "team_code eq 2005001",
'date': "2015/04/25",
# 'pretty': '',
}
res = requests.get(url, params=params)
data = res.json()
for ii, player in enumerate(data.get('results', [])):
print('- {}'.format(ii))
for key, value in sorted(player.items()):
print(' {}: {}'.format(key, value))
print(data.get('count'))
print(res.url)
print('{}: {}'.format(res.status_code, res.reason))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment