The flask of Python services

Source: Internet
Author: User

Objective:

The introduction, guidance, and examples of Python flask abound on the web. Refer to this website: http://www.pythondoc.com/flask/index.html

You may not know the Flask service: Once done a project:

A + a-server

Objective:

Provide testing or development data for commissioning/testing

Brief introduction:

A: Generate legal/illegal (traversal/non-traversal) data according to the JSONSCHEMA definition

A-server: Implements the interface, obtains the JSONSCHEMA definition in the server, passes to the a project package for processing

Highlights A-server:
1@app. Route ('/jsonschema/r/<traversal>', methods=["POST"])2 defLegal_random (traversal=False):3     #by judging the value of the passed-in traversal parameter, select whether to traverse4     ifTraversal = = 1orTraversal = ="1":5Traversal =True6     Else:7Traversal =False8 9data = {}#The data here is the definition of Jsonschema.Ten  OneClient = A.client ()#calling an interface for a project ALegal_value = client.random (data, traversal=traversal) -  -     returnMake_response (Jsonify (Legal_value))
Execution Results View:

Execute the appropriate debug code Python xxx.py can be
View directly in the browser: HTTP://IP: Port/JSONSCHEMA/R/1

The flask of Python services

Related Article

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.