goslate translate from spanish to english http error

934 Views Asked by At

I am trying to translate 2 big documents from Spanish to English with this code: import goslate

big_files = ['lenin.txt', 'liga.txt']
gs = goslate.Goslate()

translation = []
for big_file in big_files:
    with open(big_file, 'r') as f:
        translated_lines = []
        for line in f:
            translated_line = gs.translate(line, "en")
            translated_lines.append(translated_line)

        translation.append('\n'.join(translated_lines))

I am getting this error:

File "C:\Anaconda\lib\urllib\request.py", line 590, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: Service Unavailable

1

There are 1 best solutions below

1
On

A generally applicable thing to try when accessing web content through Python fails is accessing the web content through your browser to see if the problem lies in Python or somewhere else, such as your internet connection. Another even more generally applicable strategy is to Google whatever you're having trouble with. The first Google result for "goslate" return this:

Google has updated its translation service recently with a ticket mechanism to prevent simple crawler program like goslate from accessing.

https://pypi.python.org/pypi/goslate

I think that explains your problem.