Fetch cube list from CubeCobra for generate_draft_pool.py
This commit is contained in:
parent
3e409aad0f
commit
fd10676706
3 changed files with 930 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import csv
|
||||
import json
|
||||
import requests
|
||||
from pathlib import Path
|
||||
|
||||
from word_count import EXPECTED_HEADER, COLUMNS, TEMP_JSON, is_actual_mtg_card
|
||||
|
||||
|
|
@ -9,7 +10,9 @@ def request_cube_csv(cube_name, cube_id):
|
|||
url = f'https://cubecobra.com/cube/download/csv/{cube_id}'
|
||||
url += '?primary=Color%20Category&secondary=Types-Multicolor&tertiary=CMC2'
|
||||
response = requests.get(url)
|
||||
open(f'cube_csvs/{cube_name}.csv', 'wb').write(response.content)
|
||||
filename = Path('cube_csvs', f'{cube_name}.csv')
|
||||
open(filename, 'wb').write(response.content)
|
||||
return filename
|
||||
|
||||
|
||||
def load_cube_from_csv(filename, tag_filter=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue