title: Python Flask - request.data.get
body: <p>I have been asked to understand and maintain code like the following code block.</p>
  <pre><code>@app.route(&quot;/api/v1/users/register/&quot;, methods=[&quot;POST&quot;])
  def register():
      data = {
          &quot;lat&quot;: request.data.get(&quot;lat&quot;, &quot;&quot;),
          &quot;lon&quot;: request.data.get(&quot;lon&quot;, &quot;&quot;),
          &quot;is_bl_allowed&quot;: request.data.get(&quot;is_bl_allowed&quot;, 1),
          &quot;is_loc_allowed&quot;: request.data.get(&quot;is_loc_allowed&quot;, 1),
          &quot;is_bl_on&quot;: request.data.get(&quot;is_bl_on&quot;, 1),
          &quot;is_loc_on&quot;: request.data.get(&quot;is_loc_on&quot;, 1)
      }
  </code></pre>
  <p>Imports are</p>
  <pre><code>from flask import make_response
  from flask import request, jsonify
  import requests
  </code></pre>
  <p>I thought flask request used get_json or form.get to retrive POST request data.
  I am not sure what is being retrieved in this code block. I do not have access to the code that is calling this API.
  If anyone can explain what the <strong>request.data.get</strong> does, what its return value would be and why it takes 2 parameters, that would be awesome.</p>
  <p>Thanks in advance.</p>