Question: In Python3 how would you parse each character of an http post to ensure the request is valid? Primarily concerned with POST /r1.html and Content-type:

In Python3 how would you parse each character of an http post to ensure the request is valid? Primarily concerned with POST /r1.html and Content-type: ...? Possibly by import re? POST /r1.html HTTP/1.1   Host: localhost:8001   Connection: keep-alive   Content-Length: 32   Cache-Control: max-age=0   Origin: http://localhost:8001   Upgrade-Insecure-Requests: 1   User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4)   Content-Type: application/x-www-form-urlencoded
   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8   Referer: http://localhost:8001/f1.html   Accept-Encoding: gzip, deflate, br   Accept-Language: en-US,en;q=0.8
   Cookie: Webstorm-ea36d52b=7cf702c4-f920-40c7-acfd-a25b1d77b36c   fname=John&lname=Doe&gender=male

Step by Step Solution

3.45 Rating (142 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To parse and validate an HTTP POST request in Python you can use the re module regular expressions t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!