Flask's request and response objects

Source: Internet
Author: User

Some of the properties of the Request and Response objects are metadata, some are parsed, and others are just links.

Request
    • methodStart Row, metadata
    • hostStart Row, metadata
    • pathStart Row, metadata
    • environWhere SERVER_PROTOCOL is the starting row, the meta-data
    • headersheader, Meta data
    • dataBody, meta data
    • remote_addrClient Address
    • argsParameters in the request link (GET parameters), after parsing
    • formParameters in form submission, after parsing
    • valuesThe collection of args and forms
    • jsonBody data in JSON format, after parsing
    • cookiesLinks to Cookies

The Request object classifies the parameters very fine, note args , form , valeus and json the difference. Of course the most insurance and the most primitive way is to resolve themselves data .

Another area to be aware of is the type of some attributes, not the Python standard dict , but multidict or combinedmultidict. This is to deal with the setting that the parameters in the HTTP protocol are repeatable. So pay attention to the properties of these objects, such as the .get() .get_list() things returned by the method.

Response
    • statusStatus code, meta data
    • status_codeContains only the status of code
    • headersheader, Meta data
    • mimetypeRemove the content type of charset, such asapplication/json
    • dataBody, meta data

Flask's request and response objects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.