我的代碼元組或字典對象變量:得到序列或映射對象就像在URL
do_nomor = request.args.get('do_nomor', '')
bjdt_no_urut = request.args.get('bjdt_no_urut', '')
try:
SQL = """ SELECT
bjdt_id,
do_nomor,
to_char(do_tgl, 'DD/MM/YYYY') as do_tgl,
bjdt_no_urut,
bjqc_nomor,
to_char(bjqc_tgl_buat, 'DD/MM/YYYY') as bjqc_tgl_buat,
pelanggan_nama,
pry_nama,
to_char(tgl_rencana_test, 'DD/MM/YYYY') as tgl_rencana_test
from v_bendauji_detil where
bjdt_tgl_test is null and
do_nomor = %s
and bjdt_no_urut not in (%s)
ORDER BY bjdt_no_urut ASC limit 10;
"""
conn_string = "dbname='api_rc_38' user='appusr' host='localhost' password='1' port='8765' "
conn = psycopg2.connect(conn_string)
cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
data = (do_nomor, bjdt_no_urut, )
cur.execute(SQL, data)
rows = cur.fetchone()
cur.close()
conn.close()
json_data = json.dumps(rows)
return json_data
我怎麼能傳遞變量字典,網址與GET方法瓶? 像這樣的例子:
http://localhost:5000/bendauji?do_nomor=DOCKET/ICN/05-2017/5175&bjdt_no_urut=('5','6','7',)*
請添加更多的細節,你到底想要完成什麼。 –