Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/pallets/flask
/ functions
Functions
1,195 in github.com/pallets/flask
⨍
Functions
1,195
◇
Types & classes
136
↳
Endpoints
183
↓ 188 callers
Method
get
(self)
tests/test_views.py:30
↓ 52 callers
Method
register_blueprint
Register a :class:`~flask.Blueprint` on the application. Keyword arguments passed to this method will override the defaults set on the
src/flask/sansio/app.py:570
↓ 47 callers
Method
test_client
Creates a test client for this application. For information about unit testing head over to :doc:`/testing`. Note that if you are te
src/flask/app.py:669
↓ 32 callers
Method
test_request_context
Create a :class:`~flask.ctx.RequestContext` for a WSGI environment created from the given values. This is mostly useful during testing
src/flask/app.py:1423
↓ 31 callers
Method
post
(self)
tests/test_views.py:33
↓ 30 callers
Method
url_for
Generate a URL to the given endpoint with the given values. This is called by :func:`flask.url_for`, and can be called directly as we
src/flask/app.py:1003
↓ 29 callers
Method
add_url_rule
( self, rule: str, endpoint: str | None = None, view_func: ft.RouteCallable |
src/flask/sansio/app.py:605
↓ 29 callers
Method
pop
Pops the app context.
src/flask/ctx.py:256
↓ 28 callers
Method
setdefault
Get the value of an attribute if it is present, otherwise set and return a default value. Like :meth:`dict.setdefault`. :param name:
src/flask/ctx.py:92
↓ 27 callers
Method
app_context
Create an :class:`~flask.ctx.AppContext`. Use as a ``with`` block to push the context, which will make :data:`current_app` point at th
src/flask/app.py:1386
↓ 23 callers
Method
get
Get an attribute by name, or a default value. Like :meth:`dict.get`. :param name: Name of attribute to get. :param default: V
src/flask/ctx.py:67
↓ 20 callers
Method
close
(self)
tests/test_helpers.py:274
↓ 18 callers
Method
invoke
(self, app, runner)
tests/test_cli.py:459
↓ 16 callers
Method
as_view
Convert the class into a view function that can be registered for a route. By default, the generated view will create a new instance
src/flask/views.py:86
↓ 16 callers
Function
get_db
Connect to the application's configured database. The connection is unique for each request and will be reused if this is called again.
examples/tutorial/flaskr/db.py:9
↓ 15 callers
Method
open
( self, *args: t.Any, buffered: bool = False, follow_redirects: bool = False,
src/flask/testing.py:203
↓ 14 callers
Method
dumps
Serialize data as JSON. :param obj: The data to serialize. :param kwargs: May be passed to the underlying JSON library.
src/flask/json/provider.py:41
↓ 13 callers
Function
render_template
Render a template by name with the given context. :param template_name_or_list: The name of the template to render. If a list is given, t
src/flask/templating.py:138
↓ 12 callers
Method
ensure_sync
Ensure that the function is synchronous for WSGI workers. Plain ``def`` functions are returned as-is. ``async def`` functions are wrap
src/flask/app.py:966
↓ 10 callers
Method
login
(self, username="test", password="test")
examples/tutorial/tests/conftest.py:51
↓ 10 callers
Method
record_once
Works like :meth:`record` but wraps the function in another function that will ensure the function is only called once. If the bluepr
src/flask/sansio/blueprints.py:233
↓ 8 callers
Method
add
(self, app)
tests/test_testing.py:290
↓ 8 callers
Function
common_object_test
(app)
tests/test_config.py:13
↓ 8 callers
Method
run
Runs the application on a local development server. Do not use ``run()`` in a production setting. It is not intended to meet security
src/flask/app.py:546
↓ 8 callers
Function
url_for
Generate a URL to the given endpoint with the given values. This requires an active request or application context, and calls :meth:`current_
src/flask/helpers.py:188
↓ 7 callers
Method
make_response
Convert the return value from a view function to an instance of :attr:`response_class`. :param rv: the return value from the view fun
src/flask/app.py:1129
↓ 7 callers
Function
redirect
Create a redirect response object. If :data:`~flask.current_app` is available, it will use its :meth:`~flask.Flask.redirect` method, otherwis
src/flask/helpers.py:242
↓ 7 callers
Method
register_blueprint
Register a :class:`~flask.Blueprint` on this blueprint. Keyword arguments passed to this method will override the defaults set on the
src/flask/sansio/blueprints.py:256
↓ 6 callers
Method
load_app
Loads the Flask app (if not yet loaded) and returns it. Calling this multiple times will just result in the already loaded app to be
src/flask/cli.py:333
↓ 6 callers
Function
purge_module
(request)
tests/conftest.py:156
↓ 6 callers
Method
push
Binds the app context to the current context.
src/flask/ctx.py:251
↓ 6 callers
Method
redirect
Create a redirect response object. This is called by :func:`flask.redirect`, and can be called directly as well. :param loca
src/flask/sansio/app.py:893
↓ 6 callers
Function
set
()
tests/test_basic.py:236
↓ 6 callers
Method
tag
Convert the value to a valid JSON type and add the tag structure around it.
src/flask/json/tag.py:87
↓ 6 callers
Method
test_cli_runner
Create a CLI runner for testing CLI commands. See :ref:`testing-cli`. Returns an instance of :attr:`test_cli_runner_class`, by defaul
src/flask/app.py:727
↓ 5 callers
Method
_method_route
( self, method: str, rule: str, options: dict[str, t.Any], )
src/flask/sansio/scaffold.py:284
↓ 5 callers
Method
add_app_template_filter
Register a template filter, available in any template rendered by the application. Works like the :meth:`app_template_filter` decorator. Equiv
src/flask/sansio/blueprints.py:461
↓ 5 callers
Method
add_app_template_test
Register a template test, available in any template rendered by the application. Works like the :meth:`app_template_test` decorator. Equivalen
src/flask/sansio/blueprints.py:497
↓ 5 callers
Method
add_template_filter
Register a custom template filter. Works exactly like the :meth:`template_filter` decorator. :param name: the optional name of the f
src/flask/sansio/app.py:686
↓ 5 callers
Method
add_template_test
Register a custom template test. Works exactly like the :meth:`template_test` decorator. .. versionadded:: 0.10 :param name
src/flask/sansio/app.py:727
↓ 5 callers
Method
from_pyfile
Updates the values in the config from a Python file. This function behaves as if the file was imported as module with the :meth:`from
src/flask/config.py:187
↓ 5 callers
Function
get_debug_flag
Get whether debug mode should be enabled for the app, indicated by the :envvar:`FLASK_DEBUG` environment variable. The default is ``False``.
src/flask/helpers.py:27
↓ 5 callers
Method
head
(self)
tests/test_views.py:160
↓ 5 callers
Method
loads
(self, s, **kwargs)
tests/test_json.py:241
↓ 5 callers
Method
make_context
( self, info_name: str | None, args: list[str], parent: click.Context | None =
src/flask/cli.py:665
↓ 5 callers
Method
open_resource
Open a resource file relative to :attr:`root_path` for reading. For example, if the file ``schema.sql`` is next to the file ``app.py`
src/flask/app.py:330
↓ 5 callers
Method
session_transaction
When used in combination with a ``with`` statement this opens a session transaction. This can be used to modify the session that the
src/flask/testing.py:135
↓ 4 callers
Function
common_test
(app)
tests/test_views.py:7
↓ 4 callers
Method
copy
Creates a copy of this request context with the same request object. This can be used to move a request context to a different greenlet.
src/flask/ctx.py:337
↓ 4 callers
Method
delete
(self)
tests/test_views.py:213
↓ 4 callers
Method
extend
( bp_dict: dict[ft.AppOrBlueprintKey, list[t.Any]], parent_dict: dict[ft.AppOrBlueprin
src/flask/sansio/blueprints.py:380
↓ 4 callers
Function
flash
Flashes a message to the next request. In order to remove the flashed message from the session and to display it to the user, the template ha
src/flask/helpers.py:311
↓ 4 callers
Method
from_mapping
Updates the config like :meth:`update` ignoring items with non-upper keys. :return: Always returns ``True``. .. versionadded
src/flask/config.py:304
↓ 4 callers
Method
from_object
Updates the values from the given object. An object can be of one of the following two types: - a string: in this case the object
src/flask/config.py:218
↓ 4 callers
Method
from_prefixed_env
Load any environment variables that start with ``FLASK_``, dropping the prefix from the env key for the config key. Values are passed
src/flask/config.py:126
↓ 4 callers
Method
get
Shortcut for :meth:`route` with ``methods=["GET"]``. .. versionadded:: 2.0
src/flask/sansio/scaffold.py:296
↓ 4 callers
Method
get
(self, id=None)
tests/test_helpers.py:147
↓ 4 callers
Function
load_dotenv
Load "dotenv" files to set environment variables. A given path takes precedence over ``.env``, which takes precedence over ``.flaskenv``. After
src/flask/cli.py:704
↓ 4 callers
Method
loads
Deserialize data as JSON. :param s: Text or UTF-8 bytes. :param kwargs: May be passed to the underlying JSON library.
src/flask/json/provider.py:59
↓ 4 callers
Function
locate_app
( module_name: str, app_name: str | None, raise_if_not_found: t.Literal[True] = True )
src/flask/cli.py:230
↓ 4 callers
Method
register
Register a new tag with this serializer. :param tag_class: tag class to register. Will be instantiated with this serializer insta
src/flask/json/tag.py:256
↓ 4 callers
Method
request_context
Create a :class:`~flask.ctx.RequestContext` representing a WSGI environment. Use a ``with`` block to push the context, which will make
src/flask/app.py:1407
↓ 3 callers
Method
_find_error_handler
Return a registered error handler for an exception in this order: blueprint handler for a specific code, app handler for a specific code,
src/flask/sansio/app.py:823
↓ 3 callers
Method
add_url_rule
Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for full documentation. The URL rule is prefixed with the blu
src/flask/sansio/blueprints.py:413
↓ 3 callers
Method
create_url_adapter
Creates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the
src/flask/app.py:425
↓ 3 callers
Method
from_file
Update the values in the config from a file that is loaded using the ``load`` parameter. The loaded data is passed to the :meth:`from_
src/flask/config.py:256
↓ 3 callers
Method
full_dispatch_request
Dispatches the request and on top of that performs request pre and postprocessing as well as HTTP exception catching and error handlin
src/flask/app.py:904
↓ 3 callers
Method
get
(self)
tests/test_async.py:31
↓ 3 callers
Function
jsonify
Serialize the given arguments as JSON, and return a :class:`~flask.Response` object with the ``application/json`` mimetype. A dict or list ret
src/flask/json/__init__.py:138
↓ 3 callers
Method
load
Deserialize data as JSON read from a file. :param fp: A file opened for reading text or UTF-8 bytes. :param kwargs: May be passed to
src/flask/json/provider.py:67
↓ 3 callers
Method
register_error_handler
Alternative error attach function to the :meth:`errorhandler` decorator that is more straightforward to use for non decorator usage.
src/flask/sansio/scaffold.py:642
↓ 3 callers
Method
response
Serialize the given arguments as JSON, and return a :class:`~flask.Response` object with the ``application/json`` mimetype. T
src/flask/json/provider.py:89
↓ 3 callers
Method
route
Decorate a view function to register it with the given URL rule and options. Calls :meth:`add_url_rule`, which has more details about
src/flask/sansio/scaffold.py:336
↓ 3 callers
Method
send_static_file
The view function used to serve files from :attr:`static_folder`. A route is automatically registered for this view at :attr:`static_u
src/flask/app.py:308
↓ 2 callers
Method
__html__
(self)
tests/test_json.py:342
↓ 2 callers
Method
__init__
(self, *args: t.Any, **kwargs: t.Any)
src/flask/testing.py:124
↓ 2 callers
Function
_called_with_wrong_args
Check whether calling a function raised a ``TypeError`` because the call failed or because something in the factory raised the error. :pa
src/flask/cli.py:94
↓ 2 callers
Method
_copy_environ
(self, other: WSGIEnvironment)
src/flask/testing.py:184
↓ 2 callers
Function
_endpoint_from_view_func
Internal helper that returns the default endpoint for a given function. This always is the function name.
src/flask/sansio/scaffold.py:701
↓ 2 callers
Method
_get_exc_class_and_code
Get the exception class being handled. For HTTP status codes or ``HTTPException`` subclasses, return both the exception and status cod
src/flask/sansio/scaffold.py:657
↓ 2 callers
Method
_iter_loaders
(self, template: str)
src/flask/templating.py:101
↓ 2 callers
Method
_load_plugin_commands
(self)
src/flask/cli.py:600
↓ 2 callers
Method
_prepare_response_obj
( self, args: tuple[t.Any, ...], kwargs: dict[str, t.Any] )
src/flask/json/provider.py:75
↓ 2 callers
Function
_prepare_send_file_kwargs
(**kwargs: t.Any)
src/flask/helpers.py:387
↓ 2 callers
Function
_render
(app: Flask, template: Template, context: dict[str, t.Any])
src/flask/templating.py:126
↓ 2 callers
Function
_split_blueprint_path
(name: str)
src/flask/helpers.py:628
↓ 2 callers
Function
_stream
( app: Flask, template: Template, context: dict[str, t.Any] )
src/flask/templating.py:165
↓ 2 callers
Function
create_app
Create and configure an instance of the Flask application.
examples/tutorial/flaskr/__init__.py:6
↓ 2 callers
Method
dump
Serialize data as JSON and write to a file. :param obj: The data to serialize. :param fp: A file opened for writing text. Should use
src/flask/json/provider.py:49
↓ 2 callers
Method
dumps
Tag the value and dump it to a compact JSON string.
src/flask/json/tag.py:321
↓ 2 callers
Method
expect_order
(self, order, output)
tests/test_cli.py:463
↓ 2 callers
Method
finalize_request
Given the return value from a view function this finalizes the request by converting it into a response and invoking the postprocessin
src/flask/app.py:922
↓ 2 callers
Function
find_best_app
Given a module instance this tries to find the best possible application in the module or raises an exception.
src/flask/cli.py:41
↓ 2 callers
Method
from_envvar
Loads a configuration from an environment variable pointing to a configuration file. This is basically just a shortcut with nicer err
src/flask/config.py:102
↓ 2 callers
Function
generate
()
src/flask/templating.py:173
↓ 2 callers
Method
get
(self, key: str, default: t.Any = None)
src/flask/sessions.py:88
↓ 2 callers
Method
get_cookie_name
The name of the session cookie. Uses``app.config["SESSION_COOKIE_NAME"]``.
src/flask/sessions.py:185
↓ 2 callers
Function
get_load_dotenv
Get whether the user has disabled loading default dotenv files by setting :envvar:`FLASK_SKIP_DOTENV`. The default is ``True``, load the files
src/flask/helpers.py:35
↓ 2 callers
Function
get_post
Get a post and its author by id. Checks that the id exists and optionally that the current user is the author. :param id: id of post to
examples/tutorial/flaskr/blog.py:28
↓ 2 callers
Method
get_signing_serializer
(self, app: Flask)
src/flask/sessions.py:317
next →
1–100 of 1,195, ranked by callers