title: Python POST request can't find data attribute
body: <p>I'm trying to write a POST request to my Django REST API in Python, but it can't seem to find an attribute in the data section of the request. Here's the function that handles the request:</p>
  
  <pre><code> def post(self, request, id, format=None):
      obj = self.get_object_or_404(id)
  
      operation = request.POST.get('operation', None)
      if operation == None:
          print "Operation was none, uh oh."
          return Response()
      else:
          print "It worked!"
          return Response()
  </code></pre>
  
  <p>Now here's a POST ajax call in jquery. This one works. (Prints "It worked!")</p>
  
  <pre><code>$.ajax({
    method: 'POST',
    beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', 'Token ' + token)},
    url: url,
    data: {
      'operation':-1,
    },
    success: callback,
    error: function (jqXHR, textStatus, errorThrown) {
      console.log(textStatus);
      console.log(errorThrown);
    }
  });
  </code></pre>
  
  <p>Now here's the POST call in Python, or my attempt at it. The "url" and "token" variables are exactly the same:</p>
  
  <pre><code>import json
  import requests
  
  url = &lt;Same URL as above&gt;
  token = &lt;same token as above&gt;
  
  data = {
      'operation' : -1,
  }
  headers = {
      "Authorization": "Token " + token,
  }
  response = requests.post(url, data=json.dumps(data), headers=headers)
  </code></pre>
  
  <p>This python requests does not work -- the app api prints "Operation was none, uh oh." Why would this happen? Am I not passing my data parameter correctly in the request?</p>
  
  <p>EDIT: Solved. Don't call json_dumps on the data, just pass it in as is.</p>