( Tech | Security | Linux | Bike | Misc ) ramblings
Simple and elegant :)
Interesting! As I am starting to learn italian (from french), this could come handy. May I suggest a few enhancements to your script?1- Use a library that does the http for you instead of using a raw socket. There are many reasons, but it my case, I had to since at work I have to go through a proxy. urllib2 handles that.2- You receive you reply in json. Better parse json properly to get the translated phrase.3- Try not to catch all the exceptions (the except:). When I tried it the first time, it hanged (because of the proxy issue), and when I did ctrl-C, the script just continued with a bad state from that except instead of stopping.Link to my modified version: https://gist.github.com/simark/c5f3f0f173fe9cd5f092Bonne chance avec le français!