BackTranslation icon indicating copy to clipboard operation
BackTranslation copied to clipboard

Proxy Support

Open mustfkeskin opened this issue 3 years ago • 2 comments

Hello I think google ban my ip I want to send request using proxy How i can use proxy BackTranslation

mustfkeskin avatar Mar 02 '21 08:03 mustfkeskin

i just added this request. you can install with pip install BackTranslation==0.3.0 please try it with the following sample, and let me know is it work well. thx

from BackTranslation import BackTranslation
trans = BackTranslation(url=[
      'translate.google.com',
      'translate.google.co.kr',
    ], proxies={'http': '127.0.0.1:1234', 'http://host.name': '127.0.0.1:4012'})
result = trans.translate('hello', src='en', tmp = 'zh-cn')
print(result.result_text)
# 'Hello there'

hhhwwwuuu avatar Mar 03 '21 00:03 hhhwwwuuu

I think proxies not work

MNGR: Port 24000 updated MNGR: Port 24001 updated

I have 2 proxy services which running on ports 24000 and 24001

from BackTranslation import BackTranslation
trans = BackTranslation(url=[
      'translate.google.com',
      'translate.google.com.tr',
    ], proxies={'http':'http://127.0.0.1:24000',
                'http': 'http://127.0.0.1:24001'})

I run this code different cell in jupyter notebook

for i in range(10000):
    result = trans.translate('mustafa koşa koşa okula gitti', src='tr', tmp = 'en')
    print(result.result_text)

I got this error when I try to translate same text thousands of time AttributeError: 'Translator' object has no attribute 'raise_Exception'

mustfkeskin avatar Mar 10 '21 14:03 mustfkeskin