Skip to content
Snippets Groups Projects
Verified Commit 6ec74737 authored by David Beniamine's avatar David Beniamine
Browse files

Intercept unl.ru errors

parent 8288ad80
Branches
No related tags found
No related merge requests found
...@@ -32,9 +32,12 @@ def unlize(text, lang, dry_run=False): ...@@ -32,9 +32,12 @@ def unlize(text, lang, dry_run=False):
'translate': 'Process' 'translate': 'Process'
} }
try:
r = requests.post(url, data) r = requests.post(url, data)
# Remove garbage before first '[' # Remove garbage before first '['
return ''.join(r.text.partition('[')[1:]) return ''.join(r.text.partition('[')[1:])
except Exception as e:
return 'Error calling unl.ru : "{error}"'.format(error=e)
def nestedBody2Str(b): def nestedBody2Str(b):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment