How to extract HTTP message body in BaseHTTPRequestHandler.do_POST()?

You can access POST body in do_POST method like this:

for python 2

content_len = int(self.headers.getheader('content-length', 0))

for python 3

content_len = int(self.headers.get('Content-Length'))

and then read the data

post_body = self.rfile.read(content_len)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)