From 2d21dfa22931bdb887ccccba4a33e6fa4755e94b Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 26 Nov 2019 13:41:40 +0000 Subject: utils.http.Response.data should always be `bytes` - add .decode and .soup --- modules/location.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'modules/location.py') diff --git a/modules/location.py b/modules/location.py index 1858a915..dfef9244 100644 --- a/modules/location.py +++ b/modules/location.py @@ -14,11 +14,10 @@ class Module(ModuleManager.BaseModule): self.exports.add("get-location", self._get_location) def _get_location(self, s): - page = utils.http.request(URL_OPENCAGE, get_params={ - "q": s, "key": self.bot.config["opencagedata-api-key"], "limit": "1" - }, json=True) - if page and page.data["results"]: - result = page.data["results"][0] + page = utils.http.request(URL_OPENCAGE, get_params={"limit": "1", + "q": s, "key": self.bot.config["opencagedata-api-key"]}).json() + if page and page["results"]: + result = page["results"][0] timezone = result["annotations"]["timezone"]["name"] lat = result["geometry"]["lat"] lon = result["geometry"]["lng"] -- cgit v1.3.1-10-gc9f91