Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import cgi
- import cgitb
- import sys
- import json
- import cx_Oracle
- cgitb.enable()
- fs = cgi.FieldStorage()
- with open("../../password.txt", 'r') as pwf:
- pw=pwf.read().strip()
- imagequery = """
- SELECT PLACENAME_ID, COMMENT FROM PLACENAMES
- """
- conn = cx_Oracle.connect(dsn="gen", user="7", password=pw)
- c = conn.cursor()
- c.execute(imagequery)
- place_id = []
- comment = []
- for row in c:
- place_id =row[0]
- comment = row[1]
- result = {}
- result['place_id'] = place_id
- result['comment'] = comment
- sys.stdout.write("Content-Type: application/json")
- sys.stdout.write("n")
- sys.stdout.write("n")
- sys.stdout.write(json.dumps(result,indent=1))
- sys.stdout.write("n")
- sys.stdout.close()
- {
- "place_id": 5326,
- "comment": "Graveyard"
- }
Add Comment
Please, Sign In to add comment