[gedit-plugins/translate] Do not make call if no api key
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/translate] Do not make call if no api key
- Date: Sat, 10 Mar 2018 05:59:59 +0000 (UTC)
commit 6c3cc15c8f68c0e3ef26b849ac30079a04249269
Author: Jordi Mas <jmas softcatala org>
Date: Sat Mar 10 06:59:48 2018 +0100
Do not make call if no api key
plugins/translate/translate/services/yandex.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/plugins/translate/translate/services/yandex.py b/plugins/translate/translate/services/yandex.py
index 9fac9e8..eff0871 100644
--- a/plugins/translate/translate/services/yandex.py
+++ b/plugins/translate/translate/services/yandex.py
@@ -99,6 +99,10 @@ class Yandex(Service):
def _fetch_remote_language_names(self):
try:
+
+ if len(self._key) == 0:
+ return
+
url = "{0}/getLangs?ui=en&key={1}".format(self.SERVER, self._key)
response = urllib.request.urlopen(url)
payload = json.loads(response.read().decode("utf-8"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]