Skip to content

Commit 1b3a6a7

Browse files
ScreenDriverSharoon Thomas
authored andcommitted
Fixed expired token
1 parent 02af080 commit 1b3a6a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ def call(self, url, params):
134134
rv.startswith("TranslateApiException"):
135135
raise TranslateApiException(rv)
136136

137+
if isinstance(rv, str) and \
138+
rv.startswith(("ArgumentException: "
139+
"The incoming token has expired")):
140+
self.access_token = None
141+
return self.call(url, params)
137142
return rv
138143

139144
def translate(self, text, to_lang, from_lang=None,

0 commit comments

Comments
 (0)