#!/usr/bin/env python


import os, re
import sys
sys.path.insert(1, "..")

from SOAPpy import SOAPProxy, SOAPConfig

# Check for a web proxy definition in environment
try:
   proxy_url=os.environ['http_proxy']
   phost, pport = re.search('http://([^:]+):([0-9]+)', proxy_url).group(1,2)
   proxy = "%s:%s" % (phost, pport)
except:
   proxy = None

 
#                        encoding="ISO-8859-1",
server = SOAPProxy("http://www.xmethods.net/perl/soaplite.cgi",
                        config=SOAPConfig(debug=1),
                        namespace="urn:xmethodsBabelFish",
                        http_proxy=proxy)

names = server.BabelFish(translationmode="en_fr",sourcedata="to be")

print names.encode("latin-1")
