import urllib,urllib2 def doPost(self,data1,data2): data = urllib.urlencode({'data1':data1,'data2':data2}) request = urllib2.Request('http://www.xxx.com/test',data) response = urllib2.urlopen(request) file = response.read() if response.code != 200: return 'error code:'+response.code) else: return file