Fix: check availability of both source and destination language

refs #2
This commit is contained in:
ssut 2015-07-17 20:49:22 +09:00
parent 7a59b8a82a
commit 6a101f4dad
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,11 @@ Advanced usage:
result.append(translated)
return result
if dest not in LANGUAGES.keys():
raise ValueError('incorrect destination language')
if src != 'auto' and src not in LANGUAGES.keys():
raise ValueError('incorrect source language')
result = ''
sess = agent() # acquire requests session
origin = text