bandaid to fix coinlib's api

This commit is contained in:
iou1name 2020-02-26 11:33:29 -05:00
parent 784310e162
commit 90d59aff50

View File

@ -10,6 +10,7 @@ import config
from module import commands, example, require_admin
URI = "https://coinlib.io/api/v1"
HEADERS = {'cookie': "SESSIONID=91049a9e2e89f6a39f827378dd10184f;"}
@commands("crypto", "coin")
@example(".crypto btc",
@ -28,7 +29,7 @@ def crypto(bot, trigger):
symbol = trigger.args[1]
if symbol:
params["symbol"] = symbol
res = requests.get(URI + "/coin", params=params)
res = requests.get(URI + "/coin", params=params, headers=HEADERS)
if res.status_code in [400, 401]:
return bot.msg(f"Error: {res.json()['error']}")
res.raise_for_status()