Add function to request csv from CubeCobra
Add function to request csv from CubeCobra
This commit is contained in:
parent
2796b3a097
commit
17beb084cd
1 changed files with 8 additions and 0 deletions
|
|
@ -1,9 +1,17 @@
|
|||
import csv
|
||||
import json
|
||||
import requests
|
||||
|
||||
from word_count import EXPECTED_HEADER, COLUMNS, TEMP_JSON, is_actual_mtg_card
|
||||
|
||||
|
||||
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'cubecsvs/{cube_name}.csv', 'wb').write(response.content)
|
||||
|
||||
|
||||
def load_cube_from_csv(filename, tag_filter=None):
|
||||
cards = []
|
||||
with open(filename) as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue