diff options
| author | 2018-12-11 22:26:38 +0000 | |
|---|---|---|
| committer | 2018-12-11 22:26:38 +0000 | |
| commit | 793d234a0b924c0330e88f07f68b13559b42e4ac (patch) | |
| tree | 90ecd3746a77e17da915f90ec057cb16ead82c05 /modules/translate.py | |
| parent | Actually use `action_desc` in github.py.issues, so that we can see what things (diff) | |
| signature | ||
'utils.http.get_url' -> 'utils.http.request', return a Response object from
utils.http.request
Diffstat (limited to 'modules/translate.py')
| -rw-r--r-- | modules/translate.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/translate.py b/modules/translate.py index 8164c8ec..9ba05258 100644 --- a/modules/translate.py +++ b/modules/translate.py @@ -32,11 +32,12 @@ class Module(ModuleManager.BaseModule): target_language = language_match.group(2) phrase = phrase.split(" ", 1)[1] - data = utils.http.get_url(URL_TRANSLATE, get_params={ + page = utils.http.request(URL_TRANSLATE, get_params={ "client": "gtx", "sl": source_language, "tl": target_language, "dt": "t", "q": phrase}) - if data and not data == "[null,null,\"\"]": + if page and not page.data == "[null,null,\"\"]": + data = page.data while ",," in data: data = data.replace(",,", ",null,") data = data.replace("[,", "[null,") |
