 Flask Documentation (1.1.x)HTTP codes cannot be registered by code because they are not known by Werkzeug. Instead, define a subclass of HTTPException with the appropriate code and register and raise that exception class. class more information about the request, such as the IP address, may help debugging some errors. You can subclass logging.Formatter to inject your own fields that can be used in messages. You can change the formatter where you can have your own configuration. 1.11.1 Configuration Basics The config is actually a subclass of a dictionary and can be modified just like any dictionary: app = Flask(__name__) app.config['TESTING']0 码力 | 291 页 | 1.25 MB | 1 年前3 Flask Documentation (1.1.x)HTTP codes cannot be registered by code because they are not known by Werkzeug. Instead, define a subclass of HTTPException with the appropriate code and register and raise that exception class. class more information about the request, such as the IP address, may help debugging some errors. You can subclass logging.Formatter to inject your own fields that can be used in messages. You can change the formatter where you can have your own configuration. 1.11.1 Configuration Basics The config is actually a subclass of a dictionary and can be modified just like any dictionary: app = Flask(__name__) app.config['TESTING']0 码力 | 291 页 | 1.25 MB | 1 年前3
 Flask Documentation (1.1.x)Deployment Options Hosted options Self-hosted options Becoming Big Read the Source. Hook. Extend. Subclass. Wrap with middleware. Fork. Scale like a pro. Discuss with the community. API Reference If you HTTP codes cannot be registered by code because they are not known by Werkzeug. Instead, define a subclass of HTTPException [https://werkzeug.palletsprojects.com/en/2.0.x/exceptions/#werkzeug.exceptions more information about the request, such as the IP address, may help debugging some errors. You can subclass logging.Formatter [https://docs.python.org/3/library/logging.html#logging.Formatter] to inject0 码力 | 428 页 | 895.98 KB | 1 年前3 Flask Documentation (1.1.x)Deployment Options Hosted options Self-hosted options Becoming Big Read the Source. Hook. Extend. Subclass. Wrap with middleware. Fork. Scale like a pro. Discuss with the community. API Reference If you HTTP codes cannot be registered by code because they are not known by Werkzeug. Instead, define a subclass of HTTPException [https://werkzeug.palletsprojects.com/en/2.0.x/exceptions/#werkzeug.exceptions more information about the request, such as the IP address, may help debugging some errors. You can subclass logging.Formatter [https://docs.python.org/3/library/logging.html#logging.Formatter] to inject0 码力 | 428 页 | 895.98 KB | 1 年前3
 Flask-RESTful Documentation Release 0.3.10} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 42 页 | 84.60 KB | 1 年前3 Flask-RESTful Documentation Release 0.3.10} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 42 页 | 84.60 KB | 1 年前3
 Flask-RESTful Documentation
Release 0.3.104 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 39 页 | 212.29 KB | 1 年前3 Flask-RESTful Documentation
Release 0.3.104 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 39 页 | 212.29 KB | 1 年前3
 Flask-RESTful Documentation
Release 0.3.64 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 46 页 | 245.60 KB | 1 年前3 Flask-RESTful Documentation
Release 0.3.64 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 46 页 | 245.60 KB | 1 年前3
 Flask-RESTful Documentation Release 0.3.6} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 49 页 | 91.90 KB | 1 年前3 Flask-RESTful Documentation Release 0.3.6} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 49 页 | 91.90 KB | 1 年前3
 Flask-RESTful Documentation
Release 0.3.74 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 50 页 | 253.09 KB | 1 年前3 Flask-RESTful Documentation
Release 0.3.74 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 50 页 | 253.09 KB | 1 年前3
 Flask-RESTful Documentation
Release 0.3.84 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 50 页 | 253.64 KB | 1 年前3 Flask-RESTful Documentation
Release 0.3.84 Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): dumps(data), code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 50 页 | 253.64 KB | 1 年前3
 Flask-RESTful Documentation Release 0.3.8} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 55 页 | 93.30 KB | 1 年前3 Flask-RESTful Documentation Release 0.3.8} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 55 页 | 93.30 KB | 1 年前3
 Flask-RESTful Documentation Release 0.3.7} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 55 页 | 93.21 KB | 1 年前3 Flask-RESTful Documentation Release 0.3.7} Custom Fields & Multiple Values Sometimes you have your own custom formatting needs. You can subclass the fields.Raw class and implement the format function. This is especially useful when an attribute output formatting without having to modify your internal objects directly. All you have to do is subclass Raw and implement the format() method: class AllCapsString(fields.Raw): def format(self, value): code) resp.headers.extend(headers or {}) return resp Another way to accomplish this is to subclass the Api class and provide your own output functions. class Api(restful.Api): def __init__(self0 码力 | 55 页 | 93.21 KB | 1 年前3
共 10 条
- 1














