Allow tools functions to be used offline
This commit is contained in:
parent
557f006884
commit
e179b011f2
1 changed files with 14 additions and 12 deletions
|
@ -6,11 +6,11 @@ import log,variables
|
||||||
values = ["red","orange","yellow","green","blue","purple","brown","gray","special","limited"]
|
values = ["red","orange","yellow","green","blue","purple","brown","gray","special","limited"]
|
||||||
numbers = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"]
|
numbers = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"]
|
||||||
|
|
||||||
print("Getting list of deck colours")
|
|
||||||
|
|
||||||
deckkey = {}
|
deckkey = {}
|
||||||
|
|
||||||
|
try:
|
||||||
request = requests.get("https://colors-tcg.eu/cards.php?view=alpha")
|
request = requests.get("https://colors-tcg.eu/cards.php?view=alpha")
|
||||||
|
print("Getting list of deck colours")
|
||||||
alldecks = open("key.html","w")
|
alldecks = open("key.html","w")
|
||||||
alldecks.write(request.text)
|
alldecks.write(request.text)
|
||||||
alldecks.close()
|
alldecks.close()
|
||||||
|
@ -22,6 +22,8 @@ with open("key.html","r") as file:
|
||||||
filedata = filedata.replace("</td></td>","</td>")
|
filedata = filedata.replace("</td></td>","</td>")
|
||||||
with open("key.html","w") as file:
|
with open("key.html","w") as file:
|
||||||
file.write(filedata)
|
file.write(filedata)
|
||||||
|
except:
|
||||||
|
print("Using cached version of decklist")
|
||||||
|
|
||||||
with open("key.html") as decks:
|
with open("key.html") as decks:
|
||||||
decksoup = BeautifulSoup(decks, "html.parser")
|
decksoup = BeautifulSoup(decks, "html.parser")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue