You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use gtoken.py through a socks5 proxy. Based on the comment here and the example usage in gtoken.py, I tried with the following method, but failed:
$ pyenvshelldatasci
$ pipinstallpysocksipythonmatplotlib
(datasci) werner@X10DAi:~$ ipythonPython3.9.1 (default, Feb102021, 15:30:33)
Type'copyright', 'credits'or'license'formoreinformationIPython7.23.1--AnenhancedInteractivePython. Type'?'forhelp.
In [1]: importsocksIn [2]: importsocketIn [3]: socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 18889)
...: socket.socket=socks.socksocketIn [4]: fromgoogletrans.gtokenimportTokenAcquirerIn [5]: acquirer=TokenAcquirer()
In [6]: text='test'In [7]: tk=acquirer.do(text)
---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
<ipython-input-7-8223ccd9014e>in<module>---->1tk=acquirer.do(text)
~/.pyenv/versions/3.9.1/envs/datasci/lib/python3.9/site-packages/googletrans/gtoken.pyindo(self, text)
192193defdo(self, text):
-->194self._update()
195tk=self.acquire(text)
196returntk~/.pyenv/versions/3.9.1/envs/datasci/lib/python3.9/site-packages/googletrans/gtoken.pyin_update(self)
6061# this will be the same as python code after stripping out a reserved word 'var'--->62code=self.RE_TKK.search(r.text).group(1).replace('var ', '')
63# unescape special ascii characters such like a \x3d(=)64code=code.encode().decode('unicode-escape')
AttributeError: 'NoneType'objecthasnoattribute'group'
Any hints for this problem will be highly appreciated.
Regards,
HY
The text was updated successfully, but these errors were encountered:
hongyi-zhao
changed the title
Use py-googletrans through a socks5 proxy.
Generate a Google Translate API token through the Socks5 proxy using gtoken.py.
Jul 27, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I want to use gtoken.py through a socks5 proxy. Based on the comment here and the example usage in gtoken.py, I tried with the following method, but failed:
Any hints for this problem will be highly appreciated.
Regards,
HY
The text was updated successfully, but these errors were encountered: