[bugfix] [minor] [translate] update requests api
This commit is contained in:
parent
8aa807288f
commit
7b2ccc6776
1 changed files with 5 additions and 3 deletions
|
|
@ -433,11 +433,13 @@ def google_translate(lang, infile, outfile):
|
|||
"q": row[0]
|
||||
})
|
||||
|
||||
if "error" in response.json:
|
||||
print response.json
|
||||
data = response.json()
|
||||
|
||||
if "error" in data:
|
||||
print data
|
||||
continue
|
||||
|
||||
row[1] = response.json["data"]["translations"][0]["translatedText"]
|
||||
row[1] = data["data"]["translations"][0]["translatedText"]
|
||||
if not row[1]:
|
||||
row[1] = row[0] # google unable to translate!
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue