|
|||||||
Время создания: 19.04.2018 17:24
Автор: br0ke
Текстовые метки: python, flask, flask-restful, restful, rest, api, type, arg, string, empty, non-empty, non-empty string
Раздел: Информационные технологии - Python - Библиотеки - Flask - Flask-RESTful
Запись: and-semakin/mytetra_data/master/base/1524140697ogvg5w35hc/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
Make a custom function that checks the string length and throws an exception if length is 0, then use that as the argument's type def non_empty_string(s): if not s: raise ValueError("Must not be empty string") return s parser.add_argument('name', required=True, nullable=False, type=non_empty_string) |
|||||||
![]() |
|||||||
|
|||||||
|