From 714b969056c1350150dd5de946d7e73e0b11e209 Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Thu, 2 Jul 2020 01:44:18 +0000 Subject: [PATCH] GoogleCloud: pass requests params --- GoogleCloud/plugin.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/GoogleCloud/plugin.py b/GoogleCloud/plugin.py index f59671c..72fee59 100644 --- a/GoogleCloud/plugin.py +++ b/GoogleCloud/plugin.py @@ -61,14 +61,10 @@ class GoogleCloud(callbacks.Plugin): target = self.registryValue("translate.target", msg.channel) url = "https://translation.googleapis.com/language/translate/v2" if source != "auto": - url += "?q={0}&target={1}&source={2}&key={3}".format( - text.replace("&", "%26"), target, source, key - ) + params = {"target": target, "source": source, "key": key, "q": text} else: - url += "?q={0}&target={1}&key={2}".format( - text.replace("&", "%26"), target, key - ) - response = requests.get(url, timeout=10) + params = {"target": target, "key": key, "q": text} + response = requests.get(url, params=params, timeout=10) if not response.status_code == 200: log.debug( "GoogleCloud: Error accessing {0}: {1}".format(