MCPcopy Create free account

hub / github.com/pallets/flask / functions

Functions1,195 in github.com/pallets/flask

↓ 188 callersMethodget
(self)
tests/test_views.py:30
↓ 52 callersMethodregister_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 callersMethodtest_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 callersMethodtest_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 callersMethodpost
(self)
tests/test_views.py:33
↓ 30 callersMethodurl_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 callersMethodadd_url_rule
( self, rule: str, endpoint: str | None = None, view_func: ft.RouteCallable |
src/flask/sansio/app.py:605
↓ 29 callersMethodpop
Pops the app context.
src/flask/ctx.py:256
↓ 28 callersMethodsetdefault
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 callersMethodapp_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 callersMethodget
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 callersMethodclose
(self)
tests/test_helpers.py:274
↓ 18 callersMethodinvoke
(self, app, runner)
tests/test_cli.py:459
↓ 16 callersMethodas_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 callersFunctionget_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 callersMethodopen
( self, *args: t.Any, buffered: bool = False, follow_redirects: bool = False,
src/flask/testing.py:203
↓ 14 callersMethoddumps
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 callersFunctionrender_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 callersMethodensure_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 callersMethodlogin
(self, username="test", password="test")
examples/tutorial/tests/conftest.py:51
↓ 10 callersMethodrecord_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 callersMethodadd
(self, app)
tests/test_testing.py:290
↓ 8 callersFunctioncommon_object_test
(app)
tests/test_config.py:13
↓ 8 callersMethodrun
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 callersFunctionurl_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 callersMethodmake_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 callersFunctionredirect
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 callersMethodregister_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 callersMethodload_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 callersFunctionpurge_module
(request)
tests/conftest.py:156
↓ 6 callersMethodpush
Binds the app context to the current context.
src/flask/ctx.py:251
↓ 6 callersMethodredirect
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 callersFunctionset
()
tests/test_basic.py:236
↓ 6 callersMethodtag
Convert the value to a valid JSON type and add the tag structure around it.
src/flask/json/tag.py:87
↓ 6 callersMethodtest_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 callersMethod_method_route
( self, method: str, rule: str, options: dict[str, t.Any], )
src/flask/sansio/scaffold.py:284
↓ 5 callersMethodadd_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 callersMethodadd_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 callersMethodadd_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 callersMethodadd_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 callersMethodfrom_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 callersFunctionget_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 callersMethodhead
(self)
tests/test_views.py:160
↓ 5 callersMethodloads
(self, s, **kwargs)
tests/test_json.py:241
↓ 5 callersMethodmake_context
( self, info_name: str | None, args: list[str], parent: click.Context | None =
src/flask/cli.py:665
↓ 5 callersMethodopen_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 callersMethodsession_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 callersFunctioncommon_test
(app)
tests/test_views.py:7
↓ 4 callersMethodcopy
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 callersMethoddelete
(self)
tests/test_views.py:213
↓ 4 callersMethodextend
( bp_dict: dict[ft.AppOrBlueprintKey, list[t.Any]], parent_dict: dict[ft.AppOrBlueprin
src/flask/sansio/blueprints.py:380
↓ 4 callersFunctionflash
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 callersMethodfrom_mapping
Updates the config like :meth:`update` ignoring items with non-upper keys. :return: Always returns ``True``. .. versionadded
src/flask/config.py:304
↓ 4 callersMethodfrom_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 callersMethodfrom_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 callersMethodget
Shortcut for :meth:`route` with ``methods=["GET"]``. .. versionadded:: 2.0
src/flask/sansio/scaffold.py:296
↓ 4 callersMethodget
(self, id=None)
tests/test_helpers.py:147
↓ 4 callersFunctionload_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 callersMethodloads
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 callersFunctionlocate_app
( module_name: str, app_name: str | None, raise_if_not_found: t.Literal[True] = True )
src/flask/cli.py:230
↓ 4 callersMethodregister
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 callersMethodrequest_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 callersMethod_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 callersMethodadd_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 callersMethodcreate_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 callersMethodfrom_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 callersMethodfull_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 callersMethodget
(self)
tests/test_async.py:31
↓ 3 callersFunctionjsonify
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 callersMethodload
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 callersMethodregister_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 callersMethodresponse
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 callersMethodroute
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 callersMethodsend_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 callersMethod__html__
(self)
tests/test_json.py:342
↓ 2 callersMethod__init__
(self, *args: t.Any, **kwargs: t.Any)
src/flask/testing.py:124
↓ 2 callersFunction_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 callersMethod_copy_environ
(self, other: WSGIEnvironment)
src/flask/testing.py:184
↓ 2 callersFunction_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 callersMethod_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 callersMethod_iter_loaders
(self, template: str)
src/flask/templating.py:101
↓ 2 callersMethod_load_plugin_commands
(self)
src/flask/cli.py:600
↓ 2 callersMethod_prepare_response_obj
( self, args: tuple[t.Any, ...], kwargs: dict[str, t.Any] )
src/flask/json/provider.py:75
↓ 2 callersFunction_prepare_send_file_kwargs
(**kwargs: t.Any)
src/flask/helpers.py:387
↓ 2 callersFunction_render
(app: Flask, template: Template, context: dict[str, t.Any])
src/flask/templating.py:126
↓ 2 callersFunction_split_blueprint_path
(name: str)
src/flask/helpers.py:628
↓ 2 callersFunction_stream
( app: Flask, template: Template, context: dict[str, t.Any] )
src/flask/templating.py:165
↓ 2 callersFunctioncreate_app
Create and configure an instance of the Flask application.
examples/tutorial/flaskr/__init__.py:6
↓ 2 callersMethoddump
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 callersMethoddumps
Tag the value and dump it to a compact JSON string.
src/flask/json/tag.py:321
↓ 2 callersMethodexpect_order
(self, order, output)
tests/test_cli.py:463
↓ 2 callersMethodfinalize_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 callersFunctionfind_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 callersMethodfrom_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 callersFunctiongenerate
()
src/flask/templating.py:173
↓ 2 callersMethodget
(self, key: str, default: t.Any = None)
src/flask/sessions.py:88
↓ 2 callersMethodget_cookie_name
The name of the session cookie. Uses``app.config["SESSION_COOKIE_NAME"]``.
src/flask/sessions.py:185
↓ 2 callersFunctionget_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 callersFunctionget_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 callersMethodget_signing_serializer
(self, app: Flask)
src/flask/sessions.py:317
next →1–100 of 1,195, ranked by callers