views:

905

answers:

2

I want to execute this script (view source) that uses Google Translate AJAX API from python, and be able to pass arguments and get the answer back. I don't care about the HTML.

I understand I need to embed a Javascript interpreter of some sort. Does this mean I need to have a browser instance and manipulate it? What is the cleanest way to access this API from python?

+2  A: 

You can use the RESTful API instead. It's designed for environments that are not Javascript.

http://code.google.com/apis/ajaxlanguage/documentation/reference.html#_intro_fonje

That should be easy to use from Python.

Lennart Regebro
+2  A: 

You can use google-api-translate-python to talk to google api.

EDIT: It wasn't clear where the sources are, found them here.

zdmytriv
Yeah, that seems to be a simplistic wrapper of the REST API, and works as a good example of how easy it in fact is to use. :)
Lennart Regebro
That's why we love REST and JSON.
zdmytriv