Generate a Google Translate API token through the Socks5 proxy using gtoken.py
hongy...@gmail.com
hongyi.zhao at gmail.com
Tue Jul 27 22:24:35 EDT 2021
On Wednesday, July 28, 2021 at 7:25:27 AM UTC+8, cameron... at gmail.com wrote:
> Just to follow on a bit to Dennis:
But I can't any reply from Dennis in this issue.
> C:\Users\Wulfraed\Documents\_Hg-Repositories\Python Progs>python
> googletrans_test.py
> Traceback (most recent call last):
> File "googletrans_test.py", line 4, in <module>
> tk = acquirer.do(text)
> File "C:\Python38\lib\site-packages\googletrans\gtoken.py", line 194, in do
> self._update()
> File "C:\Python38\lib\site-packages\googletrans\gtoken.py", line 62, in _update
> code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
> AttributeError: 'NoneType' object has no attribute 'group'
> The implication here is that:
>
> self.RE_TKK.search(r.text).group(1)
>
> generates the error because:
>
> self.RE_TKK.search(r.text)
>
> returned None instead of a regular expression match object. That means
> that "r.text" way not what was expected.
>
> Like Dennis, i note the remark "for internal use only", suggesting this
> was some internal Google code for doing something fiddly. It may not be
> the best thing for what you're trying to do.
>
> WRT to a socks proxy, Dennis showed that the issue occurs even without a
> proxy. I would advocate doing all your debugging without trying to use
> socks, then get to going through a socks proxy _after_ the main stuff is
> working.
>
> Cheers,
> Cameron Simpson <c... at cskk.id.au>
More information about the Python-list
mailing list