Fix scryfall_requests.py
This commit is contained in:
parent
0a3cf8d657
commit
1413223b3e
3 changed files with 17 additions and 12 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
|
@ -1,3 +1,9 @@
|
||||||
|
cards_in_draft.txt
|
||||||
|
oracle_cards.json
|
||||||
|
cube_temp.json
|
||||||
|
oracle_cards_clean.json
|
||||||
|
scryfall/
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
@ -128,7 +134,4 @@ dmypy.json
|
||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.pyre/
|
||||||
.idea/workspace.xml
|
.idea/workspace.xml
|
||||||
cards_in_draft.txt
|
|
||||||
oracle_cards.json
|
|
||||||
cube_temp.json
|
|
||||||
oracle_cards_clean.json
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
import keyword_stats
|
import keyword_stats
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
f = open('set_codes.txt')
|
f = open('set_codes.csv')
|
||||||
codes = [line.strip() for line in f.readlines()]
|
codes = [line.strip() for line in f.readlines()]
|
||||||
output_file = open('set_keyword_frequency.csv', 'w+')
|
output_file = open('set_keyword_frequency.csv', 'w+')
|
||||||
output_file.write('Set,Keywords\n')
|
output_file.write('Set,Keywords\n')
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
@ -30,11 +31,12 @@ def request_set(code):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
sets = []
|
if __name__ == '__main__':
|
||||||
set_file = open('set_codes.txt')
|
sets = []
|
||||||
for line in set_file:
|
with open('set_codes.csv') as set_file:
|
||||||
sets += [line.strip()]
|
for line in set_file:
|
||||||
set_file.close()
|
sets += [line.strip()]
|
||||||
|
|
||||||
for code in sets:
|
os.makedirs(os.path.join('scryfall', 'sets'), exist_ok=True)
|
||||||
request_set(code)
|
for code in sets:
|
||||||
|
request_set(code)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue