Python: Goslate translation request returns "503: Service Unavailable" [closed]
Asked Answered
B

1

5

A few months ago, I used Python's goslate package to translate a bunch of French text to English. When I tried to do so this morning, though, the service returned an error:

import goslate
gs = goslate.Goslate()
print gs.translate('hello world', 'de')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python27\lib\site-packages\goslate.py", line 389, in translate
    return _unwrapper_single_element(self._translate_single_text(text, target_language, source_language))
  File "c:\Python27\lib\site-packages\goslate.py", line 317, in _translate_single_text
    results = list(self._execute(make_task(i) for i in split_text(text)))
  File "c:\Python27\lib\site-packages\goslate.py", line 200, in _execute
    yield each()
  File "c:\Python27\lib\site-packages\goslate.py", line 315, in <lambda>
    return lambda: self._basic_translate(text, target_language, source_lauguage)[0]
  File "c:\Python27\lib\site-packages\goslate.py", line 241, in _basic_translate
    response_content = self._open_url(url)
  File "c:\Python27\lib\site-packages\goslate.py", line 178, in _open_url
    response = self._opener.open(request, timeout=self._TIMEOUT)
  File "c:\Python27\lib\urllib2.py", line 437, in open
    response = meth(req, response)
  File "c:\Python27\lib\urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "c:\Python27\lib\urllib2.py", line 469, in error
    result = self._call_chain(*args)
  File "c:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "c:\Python27\lib\urllib2.py", line 656, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "c:\Python27\lib\urllib2.py", line 437, in open
    response = meth(req, response)
  File "c:\Python27\lib\urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "c:\Python27\lib\urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "c:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "c:\Python27\lib\urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 503: Service Unavailable

Does anyone know what happened to goslate? If it's gone for good, are there decent alternatives to the goslate package for translating French to English via an API call?

Broomrape answered 16/4, 2015 at 13:24 Comment(0)
C
3

Please make sure you're using the newest version of Goslate and if not, try updating it from its repository. There were some changes in the API this month, and they are implemented in Goslate already. I've just checked it in my app, it does work flawlessly.
In order to update Goslate, you may need to install Mercurial version controlling system.
After installing Mercurial, clone the repo with this command:

hg clone https://bitbucket.org/zhuoqiang/goslate

and then update it from time to time like this (you need to be in the repository folder for this to work):

hg pull -u
Cockloft answered 16/4, 2015 at 15:56 Comment(3)
Thanks so much! I just ran pip install -U goslate and it got me there. Thanks again!Broomrape
Seems to be down again. At least it can be called unreliable :SDuty
@Duty Damn man, damn. I have been using this for years! I don't even remember what Goslate is at this point.Weyermann

© 2022 - 2024 — McMap. All rights reserved.