1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
.. _util:
Utilities
=========
This page describes miscellaneous utilities provided by Falcon.
URI
---
.. automodule:: falcon.uri
:members: encode, encode_value, encode_check_escaped,
encode_value_check_escaped, decode, parse_host,
parse_query_string, unquote_string
Date and Time
-------------
.. NOTE(kgriffs): Use autofunction instead of automodule w/ the falcon
module, since the latter requires :noindex: which prevents us from
referencing these docs elsewhere.
.. autofunction:: falcon.http_now
.. autofunction:: falcon.dt_to_http
.. autofunction:: falcon.http_date_to_dt
.. autoclass:: falcon.TimezoneGMT
:members:
HTTP Status
-----------
.. autofunction:: falcon.http_status_to_code
.. autofunction:: falcon.code_to_http_status
.. _mediatype_util:
Media types
-----------
.. autofunction:: falcon.parse_header
.. autofunction:: falcon.mediatypes.quality
.. autofunction:: falcon.mediatypes.best_match
Async
-----
Aliases
~~~~~~~
Falcon used to provide aliases for the below functions implemented in
:mod:`asyncio`, with fallbacks for older versions of Python:
* ``falcon.get_running_loop()`` → :func:`asyncio.get_running_loop`
* ``falcon.create_task(coro, *, name=None)`` → :func:`asyncio.create_task`
However, as of Falcon 4.0+, these aliases are identical to their :mod:`asyncio`
counterparts on all supported Python versions. (They are only kept for
compatibility purposes.)
Simply use :func:`asyncio.get_running_loop` or :func:`asyncio.create_task`
directly in new code.
Adapters
~~~~~~~~
These functions help traverse the barrier between sync and async code.
.. autofunction:: falcon.sync_to_async
.. autofunction:: falcon.wrap_sync_to_async
.. autofunction:: falcon.wrap_sync_to_async_unsafe
.. autofunction:: falcon.async_to_sync
.. autofunction:: falcon.runs_sync
Other
-----
.. autofunction:: falcon.util.deprecated
.. autofunction:: falcon.util.deprecated_args
.. autofunction:: falcon.to_query_str
.. autofunction:: falcon.get_bound_method
.. autofunction:: falcon.secure_filename
.. autofunction:: falcon.is_python_func
.. autoclass:: falcon.Context
:members:
:no-undoc-members:
.. autoclass:: falcon.ETag
:members:
|