How to create a test script in Python for a registration page? -
i have website made in php.
to increase number of data sets in database, need create python script such need not add 500 registrations manually.
there several tools available need create script of own.
can 1 me ?
ps: have knowledge of php, python , asp.net well.
mysql
import mysqldb db = mysqldb.connect(host="localhost", user="john", passwd="megajonhy", db="jonhydb") cursor = db.cursor() in range(0,500): cursor.execute("insert mytable values('some string', 1337);")
postgresql
import postgresql db = postgresql.open("pq://postgres:supapass@127.0.0.1/testdb") prepstatement = db.prepare("insert mytable values($1, $2, $3);") db.xact(): in range(0, 500): prepstatement('some string', 1337, ["a", "list"])
mssql
import pyodbc cnxn = pyodbc.connect('driver={sql server};server=localhost;database=testdb;uid=user;pwd=pass') cursor = cnxn.cursor() in range(0, 500): cursor.execute("insert mytable values('some string', 1337);")
sqlalchemy
note library lot of magic you, hence you'd might not learn or desire it's functionality.
from sqlalchemy import create_engine db = create_engine("mssql://me:pass@localhost/testdb") in range(0, 500): db.execute("insert mytable values('some string', 1337);"):
how get post/get data
and finally, have no clue how run script.
mentioned web development , well, assuming run script cgi, here's how post/get data:
import cgi form = cgi.fieldstorage() print form["username"]
Comments
Post a Comment