1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Removed obsolete files

This commit is contained in:
Steffo 2016-09-13 23:43:07 +02:00 committed by GitHub
parent f411c981e8
commit db74a28c3a

View file

@ -1,29 +0,0 @@
import filemanager
import requests
# Per far funzionare questa libreria serve un file "hearthstoneapi.txt" con l'API key ricevuta da mashape.com
apikey = filemanager.readfile('hearthstoneapi.txt')
def card(name):
headers = {
'X-Mashape-Key': apikey
}
parametri = {
'locale': 'itIT'
}
# TODO: Controllare che questo non sia exploitabile per un XSS o roba del genere. Anche se dubito.
r = requests.get("https://omgvamp-hearthstone-v1.p.mashape.com/cards/" + name,
params=parametri, headers=headers)
if r.status_code != 404:
return r.json()
else:
parametri = {
'locale': 'enUS'
}
r = requests.get("https://omgvamp-hearthstone-v1.p.mashape.com/cards/search/" + name,
params=parametri, headers=headers)
if r.status_code != 404:
return r.json()
else:
raise ValueError("La carta non esiste!")