title: Simulating ajax POST call using Python Requests
body: <p><br>
  I'm doing a project where my parser <strike>steals</strike> gets data about every video on the specific site and save it to my database. I have accomplished everything except full link to the video which is hidden.<br>
  There is a player, which automaticaly starts on page load. I have found the JavaScript code which starts the player:<br></p>
  
  <pre><code>function getVidData(resolution, init) {
      &lt;&lt; some code here &gt;&gt;
      jQuery.ajax({type: 'POST', url: '/ajaxdata.php', dataType: 'json', data: 'mod=videodata&amp;vid=48902&amp;res=' + resolution, success: function (response) {
          if (response.error != '' &amp;&amp; response.error != undefined) {
          &lt;&lt; error handling code here &gt;&gt;
          } else {
              StartPlayer(response.width, response.height, response.filename);
          }
      }  });
  }
  </code></pre>
  
  <p>So after a call if no error found it starts a player using <strong>filename</strong> from <strong>response</strong>. That is what I need.<br>
  I rechecked a call in <strong>Live HTTP Headers</strong>:</p>
  
  <pre><code>http://&lt;&lt; SITE_URL &gt;&gt;/ajaxdata.php
  POST /ajaxdata.php HTTP/1.1
  Host: &lt;&lt; SITE_URL &gt;&gt;
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
  Accept: application/json, text/javascript, */*; q=0.01
  Accept-Language: en-US,en;q=0.5
  Accept-Encoding: gzip, deflate
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  X-Requested-With: XMLHttpRequest
  Referer: &lt;&lt; VIDEO_PAGE &gt;&gt;
  Content-Length: 31
  Cookie: &lt;&lt; COOKIE VALUES &gt;&gt;
  DNT: 1
  Connection: keep-alive
  Pragma: no-cache
  Cache-Control: no-cache
      mod=videodata&amp;vid=48901&amp;res=640
  
  HTTP/1.1 200 OK
  Server: nginx/1.5.9
  Date: Tue, 22 Apr 2014 16:30:06 GMT
  Content-Type: text/html
  Transfer-Encoding: chunked
  Connection: keep-alive
  Expires: Tue, 22 Apr 2014 16:30:05 GMT
  Cache-Control: no-cache
  Pragma: no-cache
  Content-Encoding: gzip
  </code></pre>
  
  <p>So it calls <strong>ajaxdata.php</strong> with specific params and in response i should find the filename.<br>
  However this Python code returns absolutely nothing to me (neither content nor errors)</p>
  
  <pre><code>import requests
  
  url = "http://LALLALAA/ajaxdata.php"
  data_video = {"mod": "videodata", "vid": "48901", 'res': '640'}
  
  s = requests.Session()
  s.post(login_url, data=login_data) # Authentication
  
  content = s.post(url, data=data_video)
  print content.content
  </code></pre>
  
  <p>Variable content prints only "Response [200]"<br>
  Now I'm completely stuck and would be grateful if anyone could point to errors I done or solutions i could try.<br>
  <br>
  Thanks</p>