Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # XML-RPC Service
- # Imports
- #from SimpleXMLRPCServer import SimpleXMLRPCServer
- #from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
- import psycopg2
- # Functions
- def lookup(params):
- conn = psycopg2.connect(host="10.0.1.5",database="endigo",user="inquire", password="imcu2007")
- print "DB Connection Opened"
- cur = conn.cursor()
- print "DB Cursor Initialized"
- cur.execute("SELECT * FROM test WHERE model LIKE %s OR manufacturer LIKE %s OR code LIKE %s;", (params,params,params))
- for record in cur:
- print record
- cur.close()
- conn.close()
- print "DB Connection Closed"
- # Create Server
- #server = SimpleXMLRPCServer (("localhost",8000), requesthandler=RequestHandler)
- # Leave server on forever, until process is shutdown
- #server.serve_forever()
- # TEST AREA
- params = '3102'
- lookup(params)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement