GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python_api_sample/db/db_query.py at master · fromcloud/python_api_sample Expand file tree/ Copy pathdb_query.pyMore file actions executable file ·52 lines (44 loc) · 1.12 KB / Copy pathdb_query.pyFile metadata and controlsexecutable file ·52 lines (44 loc) · 1.12 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 #!/usr/bin/python import sys sys.path.insert(0, "../config/") sys.path.insert(0, "../ucloudbiz/") import ucloudbiz import urllib2 import urllib import hashlib import hmac import base64 import urlparse import linecache import url_config import ast fabricurl=url_config.fabric_url hagroupname='edu_ucloudbiz_XX_hagroup!' sec='1' # 1 (public access), 0 (private access) mode='3' # 2 (Read mode), 3 (Read/Write mode) finalurl = fabricurl + 'grpcode=' + hagroupname + "&sec=" + sec + "&mode=" + mode res=urllib2.urlopen(finalurl) codes = res.read().replace('\u0000','').replace('null','').replace('(', '').replace(')', '') result=ast.literal_eval(codes) lst=result['code'].split(':') res.close() import MySQLdb as mdb import sys hostip=lst[0] portno=int(lst[1]) username='root' password='admin12345' database='sakila' sql="select title, release_year from film limit 5" print print "Host IP = %s" % hostip print "Host Port = %s" % portno print con = mdb.connect(host=hostip, port=portno, user=username, passwd=password, db=database); cur = con.cursor() cur.execute(sql) rows = cur.fetchall() for row in rows: print row con.close() print |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |