SubtitleTranslate icon indicating copy to clipboard operation
SubtitleTranslate copied to clipboard

HTTP Error 400: Bad Request

Open yeahman45 opened this issue 3 years ago • 4 comments

I have tried the sample.py and I am getting this error (I am using python 3.7):

/SubtitleTranslate-master/util_trans.py", line 73, in __post
    response = urllib.request.urlopen(request)
  File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

yeahman45 avatar Dec 09 '21 20:12 yeahman45

Me too!

Doublefire-Chen avatar Jan 19 '22 09:01 Doublefire-Chen

me too

zhijia2 avatar Jan 23 '22 18:01 zhijia2

api url已经失效。如果可以访问Google,把util_trans.py里的__translate函数中goolge.cn改成google.com即可。

sadgen avatar Nov 14 '22 14:11 sadgen

Change the base url at 78 line.

I resolve write this: url = "http://translate.googleapis.com/translate_a/single?client=t" \

EmilioSchi avatar Nov 15 '22 23:11 EmilioSchi