diff options
| author | 2019-11-26 13:41:40 +0000 | |
|---|---|---|
| committer | 2019-11-26 13:42:01 +0000 | |
| commit | 2d21dfa22931bdb887ccccba4a33e6fa4755e94b (patch) | |
| tree | 6ef5e304e3e9a69f9afd66ac0bee4d98ec115399 /modules/location.py | |
| parent | remove all `eagle` stuff from nr.py (diff) | |
utils.http.Response.data should always be `bytes` - add .decode and .soup
Diffstat (limited to 'modules/location.py')
| -rw-r--r-- | modules/location.py | 9 |
1 files changed, 4 insertions, 5 deletions
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"] |
