prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Suggest including URL variable parameters in more examples
  I'm totally new to Flask, Marshmallow, SQLAlchemy, webargs and this ecosystem. I was given a coding test and while trying to complete it, I had to use flaskparser together with an URL parameter. Not knowing how to configure them to be used together, I googled "flaskparser". The top 5 results are:
  
  - https://webargs.readthedocs.io/en/latest/_modules/webargs/flaskparser.html
  - https://webargs.readthedocs.io/en/latest/
  - https://webargs.readthedocs.io/en/latest/api.html
  - https://webargs.readthedocs.io/en/latest/advanced.html
  - https://webargs.readthedocs.io/en/latest/quickstart.html
  
  None of these include an example where an URL variable parameter and webargs are used together. I found the example that I need in [Framework Support](https://github.com/marshmallow-code/webargs/blob/dev/docs/framework_support.rst) (which does not appear on the first page of the Google results) as following:
  
  ```
  from webargs import fields
  from webargs.flaskparser import use_args
  
  
  @app.route("/user/<int:uid>")
  @use_args({"per_page": fields.Int()}, location="query")
  def user_detail(args, uid):
      return ("The user page for user {uid}, showing {per_page} posts.").format(
          uid=uid, per_page=args["per_page"]
      )
  ```
  
  Since the simpler use can can be inferred from the more complex use case, but not vice-versa, I would suggest to either include this code example in [flaskparser.py example](https://github.com/marshmallow-code/webargs/edit/dev/src/webargs/flaskparser.py), or somehow tweak the SEO for https://webargs.readthedocs.io/en/latest/framework_support.html so that it will appear on the first page of Google search results.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/webargs/flaskparser.py`
  Content:
  ```
  1 """Flask request argument parsing module.
  2 
  3 Example: ::
  4 
  5     from flask import Flask
  6 
  7     from webargs import fields
  8     from webargs.flaskparser import use_args
  9 
  10     app = Flask(__name__)
  11 
  12     hello_args = {
  13         'name': fields.Str(required=True)
  14     }
  15 
  16     @app.route('/')
  17     @use_args(hello_args)
  18     def index(args):
  19         return 'Hello ' + args['name']
  20 """
  21 import flask
  22 from werkzeug.exceptions import HTTPException
  23 
  24 from webargs import core
  25 from webargs.compat import MARSHMALLOW_VERSION_INFO
  26 from webargs.multidictproxy import MultiDictProxy
  27 
  28 
  29 def abort(http_status_code, exc=None, **kwargs):
  30     """Raise a HTTPException for the given http_status_code. Attach any keyword
  31     arguments to the exception for later processing.
  32 
  33     From Flask-Restful. See NOTICE file for license information.
  34     """
  35     try:
  36         flask.abort(http_status_code)
  37     except HTTPException as err:
  38         err.data = kwargs
  39         err.exc = exc
  40         raise err
  41 
  42 
  43 def is_json_request(req):
  44     return core.is_json(req.mimetype)
  45 
  46 
  47 class FlaskParser(core.Parser):
  48     """Flask request argument parser."""
  49 
  50     __location_map__ = dict(
  51         view_args="load_view_args",
  52         path="load_view_args",
  53         **core.Parser.__location_map__,
  54     )
  55 
  56     def _raw_load_json(self, req):
  57         """Return a json payload from the request for the core parser's load_json
  58 
  59         Checks the input mimetype and may return 'missing' if the mimetype is
  60         non-json, even if the request body is parseable as json."""
  61         if not is_json_request(req):
  62             return core.missing
  63 
  64         return core.parse_json(req.get_data(cache=True))
  65 
  66     def _handle_invalid_json_error(self, error, req, *args, **kwargs):
  67         abort(400, exc=error, messages={"json": ["Invalid JSON body."]})
  68 
  69     def load_view_args(self, req, schema):
  70         """Return the request's ``view_args`` or ``missing`` if there are none."""
  71         return req.view_args or core.missing
  72 
  73     def load_querystring(self, req, schema):
  74         """Return query params from the request as a MultiDictProxy."""
  75         return MultiDictProxy(req.args, schema)
  76 
  77     def load_form(self, req, schema):
  78         """Return form values from the request as a MultiDictProxy."""
  79         return MultiDictProxy(req.form, schema)
  80 
  81     def load_headers(self, req, schema):
  82         """Return headers from the request as a MultiDictProxy."""
  83         return MultiDictProxy(req.headers, schema)
  84 
  85     def load_cookies(self, req, schema):
  86         """Return cookies from the request."""
  87         return req.cookies
  88 
  89     def load_files(self, req, schema):
  90         """Return files from the request as a MultiDictProxy."""
  91         return MultiDictProxy(req.files, schema)
  92 
  93     def handle_error(self, error, req, schema, *, error_status_code, error_headers):
  94         """Handles errors during parsing. Aborts the current HTTP request and
  95         responds with a 422 error.
  96         """
  97         status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS
  98         # on marshmallow 2, a many schema receiving a non-list value will
  99         # produce this specific error back -- reformat it to match the
  100         # marshmallow 3 message so that Flask can properly encode it
  101         messages = error.messages
  102         if (
  103             MARSHMALLOW_VERSION_INFO[0] < 3
  104             and schema.many
  105             and messages == {0: {}, "_schema": ["Invalid input type."]}
  106         ):
  107             messages.pop(0)
  108         abort(
  109             status_code,
  110             exc=error,
  111             messages=error.messages,
  112             schema=schema,
  113             headers=error_headers,
  114         )
  115 
  116     def get_default_request(self):
  117         """Override to use Flask's thread-local request object by default"""
  118         return flask.request
  119 
  120 
  121 parser = FlaskParser()
  122 use_args = parser.use_args
  123 use_kwargs = parser.use_kwargs
  124
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/webargs/flaskparser.py b/src/webargs/flaskparser.py
  --- a/src/webargs/flaskparser.py
  +++ b/src/webargs/flaskparser.py
  @@ -9,14 +9,16 @@
   
       app = Flask(__name__)
   
  -    hello_args = {
  -        'name': fields.Str(required=True)
  +    user_detail_args = {
  +        'per_page': fields.Int()
       }
   
  -    @app.route('/')
  -    @use_args(hello_args)
  -    def index(args):
  -        return 'Hello ' + args['name']
  +    @app.route("/user/<int:uid>")
  +    @use_args(user_detail_args)
  +    def user_detail(args, uid):
  +        return ("The user page for user {uid}, showing {per_page} posts.").format(
  +            uid=uid, per_page=args["per_page"]
  +        )
   """
   import flask
   from werkzeug.exceptions import HTTPException
  
verification_info: {"golden_diff": "diff --git a/src/webargs/flaskparser.py b/src/webargs/flaskparser.py\n--- a/src/webargs/flaskparser.py\n+++ b/src/webargs/flaskparser.py\n@@ -9,14 +9,16 @@\n \n     app = Flask(__name__)\n \n-    hello_args = {\n-        'name': fields.Str(required=True)\n+    user_detail_args = {\n+        'per_page': fields.Int()\n     }\n \n-    @app.route('/')\n-    @use_args(hello_args)\n-    def index(args):\n-        return 'Hello ' + args['name']\n+    @app.route(\"/user/<int:uid>\")\n+    @use_args(user_detail_args)\n+    def user_detail(args, uid):\n+        return (\"The user page for user {uid}, showing {per_page} posts.\").format(\n+            uid=uid, per_page=args[\"per_page\"]\n+        )\n \"\"\"\n import flask\n from werkzeug.exceptions import HTTPException\n", "issue": "Suggest including URL variable parameters in more examples\nI'm totally new to Flask, Marshmallow, SQLAlchemy, webargs and this ecosystem. I was given a coding test and while trying to complete it, I had to use flaskparser together with an URL parameter. Not knowing how to configure them to be used together, I googled \"flaskparser\". The top 5 results are:\r\n\r\n- https://webargs.readthedocs.io/en/latest/_modules/webargs/flaskparser.html\r\n- https://webargs.readthedocs.io/en/latest/\r\n- https://webargs.readthedocs.io/en/latest/api.html\r\n- https://webargs.readthedocs.io/en/latest/advanced.html\r\n- https://webargs.readthedocs.io/en/latest/quickstart.html\r\n\r\nNone of these include an example where an URL variable parameter and webargs are used together. I found the example that I need in [Framework Support](https://github.com/marshmallow-code/webargs/blob/dev/docs/framework_support.rst) (which does not appear on the first page of the Google results) as following:\r\n\r\n```\r\nfrom webargs import fields\r\nfrom webargs.flaskparser import use_args\r\n\r\n\r\n@app.route(\"/user/<int:uid>\")\r\n@use_args({\"per_page\": fields.Int()}, location=\"query\")\r\ndef user_detail(args, uid):\r\n    return (\"The user page for user {uid}, showing {per_page} posts.\").format(\r\n        uid=uid, per_page=args[\"per_page\"]\r\n    )\r\n```\r\n\r\nSince the simpler use can can be inferred from the more complex use case, but not vice-versa, I would suggest to either include this code example in [flaskparser.py example](https://github.com/marshmallow-code/webargs/edit/dev/src/webargs/flaskparser.py), or somehow tweak the SEO for https://webargs.readthedocs.io/en/latest/framework_support.html so that it will appear on the first page of Google search results.\n", "before_files": [{"content": "\"\"\"Flask request argument parsing module.\n\nExample: ::\n\n    from flask import Flask\n\n    from webargs import fields\n    from webargs.flaskparser import use_args\n\n    app = Flask(__name__)\n\n    hello_args = {\n        'name': fields.Str(required=True)\n    }\n\n    @app.route('/')\n    @use_args(hello_args)\n    def index(args):\n        return 'Hello ' + args['name']\n\"\"\"\nimport flask\nfrom werkzeug.exceptions import HTTPException\n\nfrom webargs import core\nfrom webargs.compat import MARSHMALLOW_VERSION_INFO\nfrom webargs.multidictproxy import MultiDictProxy\n\n\ndef abort(http_status_code, exc=None, **kwargs):\n    \"\"\"Raise a HTTPException for the given http_status_code. Attach any keyword\n    arguments to the exception for later processing.\n\n    From Flask-Restful. See NOTICE file for license information.\n    \"\"\"\n    try:\n        flask.abort(http_status_code)\n    except HTTPException as err:\n        err.data = kwargs\n        err.exc = exc\n        raise err\n\n\ndef is_json_request(req):\n    return core.is_json(req.mimetype)\n\n\nclass FlaskParser(core.Parser):\n    \"\"\"Flask request argument parser.\"\"\"\n\n    __location_map__ = dict(\n        view_args=\"load_view_args\",\n        path=\"load_view_args\",\n        **core.Parser.__location_map__,\n    )\n\n    def _raw_load_json(self, req):\n        \"\"\"Return a json payload from the request for the core parser's load_json\n\n        Checks the input mimetype and may return 'missing' if the mimetype is\n        non-json, even if the request body is parseable as json.\"\"\"\n        if not is_json_request(req):\n            return core.missing\n\n        return core.parse_json(req.get_data(cache=True))\n\n    def _handle_invalid_json_error(self, error, req, *args, **kwargs):\n        abort(400, exc=error, messages={\"json\": [\"Invalid JSON body.\"]})\n\n    def load_view_args(self, req, schema):\n        \"\"\"Return the request's ``view_args`` or ``missing`` if there are none.\"\"\"\n        return req.view_args or core.missing\n\n    def load_querystring(self, req, schema):\n        \"\"\"Return query params from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.args, schema)\n\n    def load_form(self, req, schema):\n        \"\"\"Return form values from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.form, schema)\n\n    def load_headers(self, req, schema):\n        \"\"\"Return headers from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.headers, schema)\n\n    def load_cookies(self, req, schema):\n        \"\"\"Return cookies from the request.\"\"\"\n        return req.cookies\n\n    def load_files(self, req, schema):\n        \"\"\"Return files from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.files, schema)\n\n    def handle_error(self, error, req, schema, *, error_status_code, error_headers):\n        \"\"\"Handles errors during parsing. Aborts the current HTTP request and\n        responds with a 422 error.\n        \"\"\"\n        status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS\n        # on marshmallow 2, a many schema receiving a non-list value will\n        # produce this specific error back -- reformat it to match the\n        # marshmallow 3 message so that Flask can properly encode it\n        messages = error.messages\n        if (\n            MARSHMALLOW_VERSION_INFO[0] < 3\n            and schema.many\n            and messages == {0: {}, \"_schema\": [\"Invalid input type.\"]}\n        ):\n            messages.pop(0)\n        abort(\n            status_code,\n            exc=error,\n            messages=error.messages,\n            schema=schema,\n            headers=error_headers,\n        )\n\n    def get_default_request(self):\n        \"\"\"Override to use Flask's thread-local request object by default\"\"\"\n        return flask.request\n\n\nparser = FlaskParser()\nuse_args = parser.use_args\nuse_kwargs = parser.use_kwargs\n", "path": "src/webargs/flaskparser.py"}], "after_files": [{"content": "\"\"\"Flask request argument parsing module.\n\nExample: ::\n\n    from flask import Flask\n\n    from webargs import fields\n    from webargs.flaskparser import use_args\n\n    app = Flask(__name__)\n\n    user_detail_args = {\n        'per_page': fields.Int()\n    }\n\n    @app.route(\"/user/<int:uid>\")\n    @use_args(user_detail_args)\n    def user_detail(args, uid):\n        return (\"The user page for user {uid}, showing {per_page} posts.\").format(\n            uid=uid, per_page=args[\"per_page\"]\n        )\n\"\"\"\nimport flask\nfrom werkzeug.exceptions import HTTPException\n\nfrom webargs import core\nfrom webargs.compat import MARSHMALLOW_VERSION_INFO\nfrom webargs.multidictproxy import MultiDictProxy\n\n\ndef abort(http_status_code, exc=None, **kwargs):\n    \"\"\"Raise a HTTPException for the given http_status_code. Attach any keyword\n    arguments to the exception for later processing.\n\n    From Flask-Restful. See NOTICE file for license information.\n    \"\"\"\n    try:\n        flask.abort(http_status_code)\n    except HTTPException as err:\n        err.data = kwargs\n        err.exc = exc\n        raise err\n\n\ndef is_json_request(req):\n    return core.is_json(req.mimetype)\n\n\nclass FlaskParser(core.Parser):\n    \"\"\"Flask request argument parser.\"\"\"\n\n    __location_map__ = dict(\n        view_args=\"load_view_args\",\n        path=\"load_view_args\",\n        **core.Parser.__location_map__,\n    )\n\n    def _raw_load_json(self, req):\n        \"\"\"Return a json payload from the request for the core parser's load_json\n\n        Checks the input mimetype and may return 'missing' if the mimetype is\n        non-json, even if the request body is parseable as json.\"\"\"\n        if not is_json_request(req):\n            return core.missing\n\n        return core.parse_json(req.get_data(cache=True))\n\n    def _handle_invalid_json_error(self, error, req, *args, **kwargs):\n        abort(400, exc=error, messages={\"json\": [\"Invalid JSON body.\"]})\n\n    def load_view_args(self, req, schema):\n        \"\"\"Return the request's ``view_args`` or ``missing`` if there are none.\"\"\"\n        return req.view_args or core.missing\n\n    def load_querystring(self, req, schema):\n        \"\"\"Return query params from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.args, schema)\n\n    def load_form(self, req, schema):\n        \"\"\"Return form values from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.form, schema)\n\n    def load_headers(self, req, schema):\n        \"\"\"Return headers from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.headers, schema)\n\n    def load_cookies(self, req, schema):\n        \"\"\"Return cookies from the request.\"\"\"\n        return req.cookies\n\n    def load_files(self, req, schema):\n        \"\"\"Return files from the request as a MultiDictProxy.\"\"\"\n        return MultiDictProxy(req.files, schema)\n\n    def handle_error(self, error, req, schema, *, error_status_code, error_headers):\n        \"\"\"Handles errors during parsing. Aborts the current HTTP request and\n        responds with a 422 error.\n        \"\"\"\n        status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS\n        # on marshmallow 2, a many schema receiving a non-list value will\n        # produce this specific error back -- reformat it to match the\n        # marshmallow 3 message so that Flask can properly encode it\n        messages = error.messages\n        if (\n            MARSHMALLOW_VERSION_INFO[0] < 3\n            and schema.many\n            and messages == {0: {}, \"_schema\": [\"Invalid input type.\"]}\n        ):\n            messages.pop(0)\n        abort(\n            status_code,\n            exc=error,\n            messages=error.messages,\n            schema=schema,\n            headers=error_headers,\n        )\n\n    def get_default_request(self):\n        \"\"\"Override to use Flask's thread-local request object by default\"\"\"\n        return flask.request\n\n\nparser = FlaskParser()\nuse_args = parser.use_args\nuse_kwargs = parser.use_kwargs\n", "path": "src/webargs/flaskparser.py"}]}