From 464510cd80068a54a1d1e151b8fcbcb0af000ef4 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 2 Jul 2018 11:09:02 +0100 Subject: [PATCH] OMDBAPI now needs an api key --- bot.json.example | 3 ++- modules/imdb.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bot.json.example b/bot.json.example index e08c85a6..14fc0dd5 100644 --- a/bot.json.example +++ b/bot.json.example @@ -16,5 +16,6 @@ "tfl-api-id" : "", "tfl-api-key" : "", "eagle-api-url" : "", - "eagle-api-key" : "" + "eagle-api-key" : "", + "omdbapi-api-key" : "" } diff --git a/modules/imdb.py b/modules/imdb.py index 0c03556a..c24b4c0a 100644 --- a/modules/imdb.py +++ b/modules/imdb.py @@ -1,3 +1,5 @@ +#--require-config omdbapi-api-key + import json import Utils @@ -7,13 +9,16 @@ URL_IMDBTITLE = "http://imdb.com/title/%s" class Module(object): _name = "IMDb" def __init__(self, bot): + self.bot = bot bot.events.on("received").on("command").on("imdb").hook( self.imdb, min_args=1, help="Search for a given title on IMDb", usage="") def imdb(self, event): - page = Utils.get_url(URL_OMDB, get_params={"t": event["args"]}, + page = Utils.get_url(URL_OMDB, get_params={ + "t": event["args"], + "apikey": self.bot.config["omdbapi-api-key"]}, json=True) if page: if "Title" in page: