How can i get http body??

Frank Liou fk26541598fk at gmail.com
Wed Jul 9 23:19:33 EDT 2014


https://lh5.googleusercontent.com/-6t5tmr5T4Ys/U74FdF128oI/AAAAAAAABvo/bYyaHzsdw9Q/s1600/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg

how can i catch the "body" when  i was post ??

i want to catch body to my database and encode to base64

def hello(username):
        if request.method=='POST':
            post_insert(username)
            return username


def post_insert(username):
    init_db()
    conn = engine.connect()
    encoded = base64.b64encode(username.encode('utf-8'))
    puresql = sqla.text("INSERT INTO friends(name) VALUES(:encoded)")
    conn.execute(puresql,encoded = encoded)



More information about the Python-list mailing list