SHARE
TWEET

Untitled

a guest Oct 4th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. # XML-RPC Service
  4.  
  5.  
  6. # Imports
  7. #from SimpleXMLRPCServer import SimpleXMLRPCServer
  8. #from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
  9. import psycopg2
  10.  
  11. # Functions
  12. def lookup(params):
  13.    
  14.     conn = psycopg2.connect(host="10.0.1.5",database="endigo",user="inquire", password="imcu2007")
  15.     print "DB Connection Opened"
  16.     cur = conn.cursor()
  17.     print "DB Cursor Initialized"
  18.     cur.execute("SELECT * FROM test WHERE model LIKE %s OR manufacturer LIKE %s OR code LIKE %s;", (params,params,params))
  19.     for record in cur:
  20.         print record
  21.     cur.close()
  22.     conn.close()
  23.     print "DB Connection Closed"
  24.  
  25. # Create Server
  26. #server = SimpleXMLRPCServer (("localhost",8000), requesthandler=RequestHandler)
  27.  
  28. # Leave server on forever, until process is shutdown
  29. #server.serve_forever()
  30.  
  31. # TEST AREA
  32. params = '3102'
  33. lookup(params)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top