From 414d676988264a7c69e28fd7c94f3e363efb6b5b Mon Sep 17 00:00:00 2001 From: Suhun Han Date: Wed, 2 Dec 2020 22:10:02 +0900 Subject: [PATCH] refactor(gtoken): descriptive error message (#234) --- googletrans/gtoken.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/googletrans/gtoken.py b/googletrans/gtoken.py index b542e89..a6e6338 100644 --- a/googletrans/gtoken.py +++ b/googletrans/gtoken.py @@ -65,17 +65,7 @@ def _update(self): code = code.group(1).replace('var ', '') # unescape special ascii characters such like a \x3d(=) code = code.encode().decode('unicode-escape') - - try: - # this will be the same as python code after stripping out a reserved word 'var' - code = self.RE_TKK.search(r.text).group(1).replace('var ', '') - # unescape special ascii characters such like a \x3d(=) - code = code.encode().decode('unicode-escape') - except AttributeError: - raise Exception('Could not find TKK token for this request.\nSee https://github.com/ssut/py-googletrans/issues/234 for more details.') - except: - raise - + if code: tree = ast.parse(code) visit_return = False