How to use 'flask post request' in Python

Every line of 'flask post request' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
35@pytest.mark.parametrize(
36 'params, expected', (
37 ({"age": 3, "name": "Hi", "email": "wudong@eastwu.cn"},
38 {'code': 563, 'message': 'age字段的取值只能是以下几种[1, 2]!'}),
39 )
40)
41def test_post_request(self, params, expected):
42 resp = requests.post("http://127.0.0.1:5000/test", params)
43 assert resp.status_code == 200
44 assert resp.json() == expected
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets