51 def sendMessage(host,port,dbsInst,userInput,page,limit,xml=0,case='on',iface='dd',details=0,cff=0,debug=0):
53 Send message to server, message should be an well formed XML document. 59 input=urllib.quote(userInput)
61 httplib.HTTPConnection.debuglevel = 1
62 print "Contact",host,port
64 if host.find(
"http://")!=-1:
66 if host.find(
"https://")!=-1:
68 host=host.replace(
"http://",
"").
replace(
"https://",
"")
69 if host.find(
":")==-1:
72 if host.find(
"/")!=-1:
75 prefix_path=
'/'.
join(hs[1:])
76 if host.find(
":")!=-1:
77 host,port=host.split(
":")
81 http_conn = httplib.HTTPS(host,port)
83 http_conn = httplib.HTTP(host,port)
86 path=
'/aSearch?dbsInst=%s&html=0&caseSensitive=%s&_idx=%s&pagerStep=%s&userInput=%s&xml=%s&details=%s&cff=%s&method=%s'%(dbsInst,case,page,limit,input,xml,details,cff,iface)
88 path=
"/"+prefix_path+path[1:]
89 http_conn.putrequest(
'POST',path)
90 http_conn.putheader(
'Host',host)
91 http_conn.putheader(
'Content-Type',
'text/html; charset=utf-8')
92 http_conn.putheader(
'Content-Length',
str(len(input)))
93 http_conn.endheaders()
96 (status_code,msg,reply)=http_conn.getreply()
97 data=http_conn.getfile().read()
98 if debug
or msg!=
"OK":
100 print http_conn.headers
101 print "*** Send message ***" 103 print "************************************************************************" 104 print "status code:",status_code
106 print "************************************************************************" def replace(string, replacements)
static std::string join(char **cmd)
def sendMessage(host, port, dbsInst, userInput, page, limit, xml=0, case='on', iface='dd', details=0, cff=0, debug=0)