title: Flask add parameter to view methods in before_request
body: <p>Lets say I have an API at /api/something. The API requires a definition for api_key, it looks in the request arguments and the cookies. If it finds the api_key, I want it to pass the api_key to the route methods, in this case <code>something</code>.</p>
  
  <pre><code>@app.before_request
  def pass_api_key():
      api_key = request.args.get('api_key', None)
      if api_key is None:
          api_key = request.cookies.get('api_key', None)
      if api_key is None:
          return 'api_key is required'
      # add parameter of api_key to something method
  
  @app.route('/api/something')
  def something(api_key):
      return api_key
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>Thanks in advance.</p>