52 def sendMessage(host,port,dbsInst,userInput,page,limit,xml=0,case='on',iface='dd',details=0,cff=0,debug=0):
54 Send message to server, message should be an well formed XML document. 60 input=urllib.quote(userInput)
62 httplib.HTTPConnection.debuglevel = 1
63 print(
"Contact",host,port)
65 if host.find(
"http://")!=-1:
67 if host.find(
"https://")!=-1:
69 host=host.replace(
"http://",
"").
replace(
"https://",
"")
70 if host.find(
":")==-1:
73 if host.find(
"/")!=-1:
76 prefix_path=
'/'.
join(hs[1:])
77 if host.find(
":")!=-1:
78 host,port=host.split(
":")
82 http_conn = httplib.HTTPS(host,port)
84 http_conn = httplib.HTTP(host,port)
87 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)
89 path=
"/"+prefix_path+path[1:]
90 http_conn.putrequest(
'POST',path)
91 http_conn.putheader(
'Host',host)
92 http_conn.putheader(
'Content-Type',
'text/html; charset=utf-8')
93 http_conn.putheader(
'Content-Length',
str(len(input)))
94 http_conn.endheaders()
97 (status_code,msg,reply)=http_conn.getreply()
98 data=http_conn.getfile().
read()
99 if debug
or msg!=
"OK":
101 print(http_conn.headers)
102 print(
"*** Send message ***")
104 print(
"************************************************************************")
105 print(
"status code:",status_code)
106 print(
"message:",msg)
107 print(
"************************************************************************")
def replace(string, replacements)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
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)