CMS 3D CMS Logo

Classes | Functions | Variables
query Namespace Reference

Classes

class  DDOptionParser
 

Functions

def sendMessage (host, port, dbsInst, userInput, page, limit, xml=0, case='on', iface='dd', details=0, cff=0, debug=0)
 

Variables

 args
 
 dbsInst
 
 host
 
 input
 
 optManager
 
 opts
 
 port
 
 result
 

Function Documentation

def query.sendMessage (   host,
  port,
  dbsInst,
  userInput,
  page,
  limit,
  xml = 0,
  case = 'on',
  iface = 'dd',
  details = 0,
  cff = 0,
  debug = 0 
)
   Send message to server, message should be an well formed XML document.

Definition at line 51 of file query.py.

References createfilelist.int, join(), python.rootplot.root2matplotlib.replace(), and harvestTrackValidationPlots.str.

51 def sendMessage(host,port,dbsInst,userInput,page,limit,xml=0,case='on',iface='dd',details=0,cff=0,debug=0):
52  """
53  Send message to server, message should be an well formed XML document.
54  """
55  if xml: xml=1
56  else: xml=0
57  if cff: cff=1
58  else: cff=0
59  input=urllib.quote(userInput)
60  if debug:
61  httplib.HTTPConnection.debuglevel = 1
62  print "Contact",host,port
63  _port=443
64  if host.find("http://")!=-1:
65  _port=80
66  if host.find("https://")!=-1:
67  _port=443
68  host=host.replace("http://","").replace("https://","")
69  if host.find(":")==-1:
70  port=_port
71  prefix_path=""
72  if host.find("/")!=-1:
73  hs=host.split("/")
74  host=hs[0]
75  prefix_path='/'.join(hs[1:])
76  if host.find(":")!=-1:
77  host,port=host.split(":")
78  port=int(port)
79 # print "\n\n+++",host,port
80  if port==443:
81  http_conn = httplib.HTTPS(host,port)
82  else:
83  http_conn = httplib.HTTP(host,port)
84  if details: details=1
85  else: details=0
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)
87  if prefix_path:
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()
94  http_conn.send(input)
95 
96  (status_code,msg,reply)=http_conn.getreply()
97  data=http_conn.getfile().read()
98  if debug or msg!="OK":
99  print
100  print http_conn.headers
101  print "*** Send message ***"
102  print input
103  print "************************************************************************"
104  print "status code:",status_code
105  print "message:",msg
106  print "************************************************************************"
107  print reply
108  return data
109 
110 #
111 # main
112 #
def replace(string, replacements)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def sendMessage(host, port, dbsInst, userInput, page, limit, xml=0, case='on', iface='dd', details=0, cff=0, debug=0)
Definition: query.py:51

Variable Documentation

query.args

Definition at line 118 of file query.py.

query.dbsInst

Definition at line 116 of file query.py.

query.host
query.input

Definition at line 131 of file query.py.

query.optManager

Definition at line 117 of file query.py.

query.opts

Definition at line 118 of file query.py.

query.port
query.result

Definition at line 137 of file query.py.