From 69d58eede2e9bf83aa1ed1d8fcf956efde494726 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 3 Oct 2018 13:22:37 +0100 Subject: Move src/Utils.py in to src/utils/, splitting functionality out in to modules of related functionality --- modules/define.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/define.py') diff --git a/modules/define.py b/modules/define.py index dbd1e420..f0d696d0 100644 --- a/modules/define.py +++ b/modules/define.py @@ -1,7 +1,7 @@ #--require-config wordnik-api-key import time -from src import ModuleManager, Utils +from src import ModuleManager, utils URL_WORDNIK = "https://api.wordnik.com/v4/word.json/%s/definitions" URL_WORDNIK_RANDOM = "https://api.wordnik.com/v4/words.json/randomWord" @@ -12,14 +12,14 @@ class Module(ModuleManager.BaseModule): _last_called = 0 def _get_definition(self, word): - page = Utils.get_url(URL_WORDNIK % word, get_params={ + page = utils.http.get_url(URL_WORDNIK % word, get_params={ "useCanonical": "true", "limit": 1, "sourceDictionaries": "wiktionary", "api_key": self.bot.config[ "wordnik-api-key"]}, json=True) return page - @Utils.hook("received.command.define") + @utils.hook("received.command.define") def define(self, event): """ :help: Define a provided term @@ -40,7 +40,7 @@ class Module(ModuleManager.BaseModule): else: event["stderr"].write("Failed to load results") - @Utils.hook("received.command.randomword") + @utils.hook("received.command.randomword") def random_word(self, event): """ :help: Define a random word @@ -49,7 +49,7 @@ class Module(ModuleManager.BaseModule): RANDOM_DELAY_SECONDS): self._last_called = time.time() - page = Utils.get_url(URL_WORDNIK_RANDOM, get_params={ + page = utils.http.get_url(URL_WORDNIK_RANDOM, get_params={ "api_key":self.bot.config["wordnik-api-key"], "min_dictionary_count":1},json=True) if page and len(page): -- cgit v1.3.1-10-gc9f91