sdkagent

flask API reference

62 public APIs from flask (pallets/flask) — 11 classes, 17 functions, 34 methods. Signatures extracted by static analysis of the actual source.

Repository: pallets/flask

KindCount
Classes11
Functions17
Methods34

API list

methodsrc.flask.blueprints.Blueprint.send_static_file(filename:str) -> Response
The view function used to serve files from :attr:`static_folder`.
classsrc.flask.cli.CertParamType
Click option type for the ``--cert`` option.
classsrc.flask.cli.NoAppException
Raised if an application cannot be found or loaded.
classsrc.flask.cli.ScriptInfo
Helper object to deal with Flask applications.
methodsrc.flask.cli.ScriptInfo.load_app() -> Flask
Loads the Flask app (if not yet loaded) and returns it.
funcsrc.flask.cli.find_app_by_string(module:ModuleType, app_name:str) -> Flask
Check if the given string is a variable name or a function.
funcsrc.flask.cli.load_dotenv(path:str | os.PathLike[str] | None=None, load_defaults:bool=True) -> bool
Load "dotenv" files to set environment variables.
funcsrc.flask.cli.routes_command(sort:str, all_methods:bool) -> None
Show all registered routes with endpoints and methods.
methodsrc.flask.config.Config.from_object(obj:object | str) -> None
Updates the values from the given object.
methodsrc.flask.config.Config.from_pyfile(filename:str | os.PathLike[str], silent:bool=False) -> bool
Updates the values in the config from a Python file.
classsrc.flask.config.ConfigAttribute
Makes an attribute forward to the config
funcsrc.flask.ctx.after_this_request(f:ft.AfterRequestCallable[t.Any]) -> ft.AfterRequestCallable[t.Any]
Decorate a function to run after the current request.
funcsrc.flask.ctx.copy_current_request_context(f:F) -> F
Decorate a function to run inside the current request context.
funcsrc.flask.ctx.has_app_context() -> bool
Test if an app context is active.
classsrc.flask.debughelpers.DebugFilesKeyError
Raised from request.files during debugging.
funcsrc.flask.helpers.flash(message:str, category:str='message') -> None
Flashes a message to the next request.
funcsrc.flask.helpers.get_root_path(import_name:str) -> str
Find the root path of a package, or the path that contains a module.
funcsrc.flask.helpers.get_template_attribute(template_name:str, attribute:str) -> t.Any
Loads a macro (or variable) a template exports.
funcsrc.flask.helpers.make_response(*args:t.Any) -> Response
Sometimes it is necessary to set additional headers in a view.
funcsrc.flask.helpers.redirect(location:str, code:int=303, Response:type[BaseResponse] | None=None) -> BaseResponse
Create a redirect response object.
funcsrc.flask.json.dump(obj:t.Any, fp:t.IO[str], **kwargs:t.Any) -> None
Serialize data as JSON and write to a file.
funcsrc.flask.json.dumps(obj:t.Any, **kwargs:t.Any) -> str
Serialize data as JSON.
funcsrc.flask.json.load(fp:t.IO[t.AnyStr], **kwargs:t.Any) -> t.Any
Deserialize data as JSON read from a file.
funcsrc.flask.json.loads(s:str | bytes, **kwargs:t.Any) -> t.Any
Deserialize data as JSON.
classsrc.flask.json.provider.JSONProvider
A standard set of JSON operations for an application.
methodsrc.flask.json.provider.JSONProvider.dump(obj:t.Any, fp:t.IO[str], **kwargs:t.Any) -> None
Serialize data as JSON and write to a file.
methodsrc.flask.json.provider.JSONProvider.dumps(obj:t.Any, **kwargs:t.Any) -> str
Serialize data as JSON.
methodsrc.flask.json.provider.JSONProvider.load(fp:t.IO[t.AnyStr], **kwargs:t.Any) -> t.Any
Deserialize data as JSON read from a file.
methodsrc.flask.json.provider.JSONProvider.loads(s:str | bytes, **kwargs:t.Any) -> t.Any
Deserialize data as JSON.
methodsrc.flask.json.tag.JSONTag.check(value:t.Any) -> bool
Check if the given value should be tagged by this tag.
methodsrc.flask.json.tag.JSONTag.to_json(value:t.Any) -> t.Any
Convert the Python object to an object that is a valid JSON type.
methodsrc.flask.json.tag.JSONTag.to_python(value:t.Any) -> t.Any
Convert the JSON representation back to the correct type.
classsrc.flask.json.tag.TagDict
Tag for 1-item dicts whose only key matches a registered tag.
funcsrc.flask.logging.create_logger(app:App) -> logging.Logger
Get the Flask app's logger and configure it if needed.
methodsrc.flask.sansio.app.App.add_template_filter(f:ft.TemplateFilterCallable, name:str | None=None) -> None
Register a function to use as a custom Jinja filter.
methodsrc.flask.sansio.app.App.add_template_global(f:ft.TemplateGlobalCallable, name:str | None=None) -> None
Register a function to use as a custom Jinja global.
methodsrc.flask.sansio.app.App.add_template_test(f:ft.TemplateTestCallable, name:str | None=None) -> None
Register a function to use as a custom Jinja test.
methodsrc.flask.sansio.app.App.create_global_jinja_loader() -> DispatchingJinjaLoader
Creates the loader for the Jinja environment.
methodsrc.flask.sansio.app.App.debug() -> bool
Whether debug mode is enabled.
methodsrc.flask.sansio.app.App.jinja_env() -> Environment
The Jinja environment used to load templates.
methodsrc.flask.sansio.app.App.make_aborter() -> Aborter
Create the object to assign to :attr:`aborter`.
methodsrc.flask.sansio.app.App.make_config(instance_relative:bool=False) -> Config
Used to create the config attribute by the Flask constructor.
methodsrc.flask.sansio.app.App.name() -> str
The name of the application.
methodsrc.flask.sansio.app.App.redirect(location:str, code:int=303) -> BaseResponse
Create a redirect response object.
methodsrc.flask.sansio.app.App.register_blueprint(blueprint:Blueprint, **options:t.Any) -> None
Register a :class:`~flask.Blueprint` on the application.
methodsrc.flask.sansio.app.App.shell_context_processor(f:T_shell_context_processor) -> T_shell_context_processor
Registers a shell context processor function.
methodsrc.flask.sansio.app.App.teardown_appcontext(f:T_teardown) -> T_teardown
Registers a function to be called when the app context is popped.
methodsrc.flask.sansio.app.App.trap_http_exception(e:Exception) -> bool
Checks if an HTTP exception should be trapped or not.
methodsrc.flask.sansio.blueprints.Blueprint.add_app_template_filter(f:ft.TemplateFilterCallable, name:str | None=None) -> None
Register a function to use as a custom Jinja filter.
methodsrc.flask.sansio.blueprints.Blueprint.add_app_template_global(f:ft.TemplateGlobalCallable, name:str | None=None) -> None
Register a function to use as a custom Jinja global.
methodsrc.flask.sansio.blueprints.Blueprint.add_app_template_test(f:ft.TemplateTestCallable, name:str | None=None) -> None
Register a function to use as a custom Jinja test.
methodsrc.flask.sansio.blueprints.Blueprint.register_blueprint(blueprint:Blueprint, **options:t.Any) -> None
Register a :class:`~flask.Blueprint` on this blueprint.
classsrc.flask.sessions.SecureCookieSession
Base class for sessions based on signed cookies.
classsrc.flask.sessions.SessionMixin
Expands a basic dictionary with session attributes.
methodsrc.flask.sessions.SessionMixin.permanent() -> bool
This reflects the ``'_permanent'`` key in the dict.
funcsrc.flask.templating.render_template(template_name_or_list:str | Template | list[str | Template], **context:t.Any) -> str
Render a template by name with the given context.
methodsrc.flask.views.View.dispatch_request() -> ft.ResponseReturnValue
The actual view function behavior.
classsrc.flask.wrappers.Request
The request object used by default in Flask.
methodsrc.flask.wrappers.Request.blueprint() -> str | None
The registered name of the current blueprint.
methodsrc.flask.wrappers.Request.endpoint() -> str | None
The endpoint that matched the request URL.
classsrc.flask.wrappers.Response
The response object that is used by default in Flask.
methodsrc.flask.wrappers.Response.max_cookie_size() -> int
Read-only view of the :data:`MAX_COOKIE_SIZE` config key.

About this data

These signatures were extracted from the public source of pallets/flask using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries