Create a new request object based on the values provided. If environ is given missing values are filled from there. This method is useful for small scripts when you need to simulate a request from an URL. Do not use this method for unittesting, there is a full featured clie
(cls, *args: t.Any, **kwargs: t.Any)
| 134 | |
| 135 | @classmethod |
| 136 | def from_values(cls, *args: t.Any, **kwargs: t.Any) -> Request: |
| 137 | """Create a new request object based on the values provided. If |
| 138 | environ is given missing values are filled from there. This method is |
| 139 | useful for small scripts when you need to simulate a request from an URL. |
| 140 | Do not use this method for unittesting, there is a full featured client |
| 141 | object (:class:`Client`) that allows to create multipart requests, |
| 142 | support for cookies etc. |
| 143 | |
| 144 | This accepts the same options as the |
| 145 | :class:`~werkzeug.test.EnvironBuilder`. |
| 146 | |
| 147 | .. versionchanged:: 0.5 |
| 148 | This method now accepts the same arguments as |
| 149 | :class:`~werkzeug.test.EnvironBuilder`. Because of this the |
| 150 | `environ` parameter is now called `environ_overrides`. |
| 151 | |
| 152 | :return: request object |
| 153 | """ |
| 154 | from ..test import EnvironBuilder |
| 155 | |
| 156 | builder = EnvironBuilder(*args, **kwargs) |
| 157 | try: |
| 158 | return builder.get_request(cls) |
| 159 | finally: |
| 160 | builder.close() |
| 161 | |
| 162 | @classmethod |
| 163 | def application(cls, f: t.Callable[[Request], WSGIApplication]) -> WSGIApplication: |