Translating text using Google Translate mobile site
import translate.translate
translate.translate.translate("hello")


The verbosity is strong with this one. The clarity is not.

Why do you have a translate in a translate in a translate? With constructs like this, you can bet there are better names available.

Inside your main the same problem occurs:

to_translate = 'Bonjour comment allez vous?'
print("%s &gt;&gt; %s" % (to_translate, translate(to_translate)))
print("%s &gt;&gt; %s" % (to_translate, translate(to_translate, 'es')))
print("%s &gt;&gt; %s" % (to_translate, translate(to_translate, 'ar')))


That's 3 counts of translate per call. It's obvious you're translating something, but the rest is vague.

Afar from that, are you familiar with the Python Enhancement Proposals? Some of them include style suggestions, most notably the PEP 8. You might want to take at least a good look at it.

The most notable violation of your code against the PEP 8 is your lines are too long. Long lines are hard to read, hard to parse by humans. The readability of your code will improve if you split them up logically.

The ugly way of breaking-up lines is with line continuations:

agent = {'User-Agent' : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"}
agent2 = {'User-Agent' : "Mozilla/4.0 (\
compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; \
.NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"}
print agent
print agent2


Those produce the same output.

The proper way would be turning agent into a proper data format and parsing it on request or reading it from somewhere else. You really shouldn't have hard-coded strings that long in your code anyway.