Python+flask writes a simple login interface example

When learning interface testing, I often worry because there is no actual interface for testing. Here we teach you to write two interfaces for learning interface testing.

1. Write a login interface

Python+flask writes a simple login interface example

2. Run in pycharm

Python+flask writes a simple login interface example

3. Use apipost to test the login interface

Enter the url and parameter value to access, the access is successful.
Python+flask writes a simple login interface example

4. Check pycharm for normal access

Python+flask writes a simple login interface example

5. Writing a query interface that requires direct access to the token returned by login

Python+flask writes a simple login interface example

6. Run the login and query two interfaces

Python+flask writes a simple login interface example

7. Use apipost for login and query interface testing

First perform the login interface test to get the returned token
Python+flask writes a simple login interface example

Use the token value returned by login to query the interface test
Python+flask writes a simple login interface example

8. Tools used

Interface writing tool: python, pycharm, flask framework
interface testing tool: apipost

Download link of interface test tool:https://www.apipost.cn

Guess you like

Origin blog.51cto.com/12246704/2550265