Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74291 > unrolled thread

How can i get http body??

Started byFrank Liou <fk26541598fk@gmail.com>
First post2014-07-09 20:19 -0700
Last post2014-07-10 18:20 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  How can i get http body?? Frank Liou <fk26541598fk@gmail.com> - 2014-07-09 20:19 -0700
    Re: How can i get http body?? Roy Smith <roy@panix.com> - 2014-07-10 10:02 -0400
      Re: How can i get http body?? Frank Liou <fk26541598fk@gmail.com> - 2014-07-10 18:20 -0700

#74291 — How can i get http body??

FromFrank Liou <fk26541598fk@gmail.com>
Date2014-07-09 20:19 -0700
SubjectHow can i get http body??
Message-ID<4574254f-e813-4f16-bafb-cbd649496095@googlegroups.com>
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)

[toc] | [next] | [standalone]


#74301

FromRoy Smith <roy@panix.com>
Date2014-07-10 10:02 -0400
Message-ID<roy-4E2B43.10021110072014@news.panix.com>
In reply to#74291
In article <4574254f-e813-4f16-bafb-cbd649496095@googlegroups.com>,
 Frank Liou <fk26541598fk@gmail.com> wrote:

> https://lh5.googleusercontent.com/-6t5tmr5T4Ys/U74FdF128oI/AAAAAAAABvo/bYyaHzs
> dw9Q/s1600/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg
> 
> how can i catch the "body" when  i was post ??


Take a look at the wonderful requests package.  It makes all of this 
very simple.

http://docs.python-requests.org/

[toc] | [prev] | [next] | [standalone]


#74336

FromFrank Liou <fk26541598fk@gmail.com>
Date2014-07-10 18:20 -0700
Message-ID<28c2db6c-952c-4ca9-af22-7a877ae8a65b@googlegroups.com>
In reply to#74301
Got it Thanks you

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web