title: HTTP POST request returns Response 200 but no change in state at server
body: <p>A function <em>answer_questions</em> written for answering a question randomly on <a href="http://okcupid.com" rel="nofollow">OKcupid</a>. I wrote it as an extension of <em>User</em> class in <a href="https://github.com/evfredericksen/pyokc" rel="nofollow">pyokc</a></p>
  
  <pre><code>def answer_questions(self):
  
  """
  Submit random answers to questions lying unanswered for
  given User. Takes the number of questions to be answered
  as argument
  """
  
      get_questions = self._session.post('http://www.okcupid.com/profile/{0}/questions'.format(self.username))
      tree = html.fromstring(get_questions.content.decode('utf8'))
      new_question = tree.xpath("//*[@id='new_question']")[0]
  
  
      # question ID as well as targetid (associated with each User )
      qid = int(tree.xpath("//div[contains(@id,'qtext_')]/@id")[0].split("_")[1])
      targetid = int(tree.xpath("//input[@id='target_userid']/@value")[0])
  
      number_of_answers = len(new_question.xpath(".//input[contains(@id,'my_answer_')]/@id"))
      number_of_acceptable_answers = len(new_question.xpath(".//input[contains(@id,'their_answer_')]/@id"))
  
  
      request_parameters = {
          'ajax': 1,
          'submit': 1,
          'answer_question' : 1,
          'skip' : 0,
          'show_all' : 0,
          'targetid' : targetid,
          'qid' : qid,
          'is_new' :1,
          'answers' : random.randint(1, number_of_answers),
          'matchanswers' : random.randint(1,number_of_acceptable_answers),
          'importance' : 4,
          'is_public': 1,
          'note' : '',
          'delete_note' : 0,
          }
  
      headers = {
          'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.74 Safari/537.36',
          'Accept': 'application/json, text/javascript, */*; q=0.01',
          'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
          'X-Requested-With': 'XMLHttpRequest'
          }  
  
      profiles_request = self._session.post('http://www.okcupid.com/profile/{0}/questions/'.format(self.username), data=request_parameters, headers=headers )
      print (profiles_request)
  </code></pre>
  
  <p>The POST request returns response 200 but the question is still shown unanswered on my profile ie no change in state of server. </p>
  
  <p>For a question I answer directly on okcupid, the headers and form data as shown by fiddler are as follows :-</p>
  
  <p><strong>General</strong></p>
  
  <pre><code>Remote Address:198.41.209.133:80
  Request URL:http://www.okcupid.com/questions/ask
  Request Method:POST
  Status Code:200 OK
  </code></pre>
  
  <p><strong>Response Headers</strong></p>
  
  <pre><code>Cache-control:private
  CF-RAY:1e7ea9cb7f7d0bb7-HKG
  Connection:keep-alive
  Content-Encoding:gzip
  Content-Type:text/html; charset=utf-8
  Date:Sun, 17 May 2015 10:33:18 GMT
  P3P:CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT", policyref="http://www.okcupid.com/w3c/p3p.xml"
  Server:cloudflare-nginx
  Transfer-Encoding:chunked
  X-OKWS-Version:OKWS/3.1.33.0
  X-XSS-Protection:1; mode=block
  </code></pre>
  
  <p><strong>Request Headers</strong></p>
  
  <pre><code>Accept:application/json, text/javascript, */*; q=0.01
  Accept-Encoding:gzip, deflate
  Accept-Language:en-US,en;q=0.8
  Connection:keep-alive
  Content-Length:168
  Content-Type:application/x-www-form-urlencoded; charset=UTF-8
  Cookie:__cfduid=d8678fe61e59e41eb20e760ae5c70a0f71430320840; authlink=5cbd8d4f6953a34e; signup_exp_2014_09_13=2014_simpleblue; override_session=0; session=123132212344212%3a6473645976835253592; nano=k%3Diframe_prefix_lock_1%2Ce%3D1431858786856%2Cv%3D1%7Ck%3Diframe_prefix_lock_2%2Ce%3D1431858856830%2Cv%3D1
  Host:www.okcupid.com
  Origin:http://www.okcupid.com
  Referer:http://www.okcupid.com/questions
  User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.74 Safari/537.36
  X-Requested-With:XMLHttpRequest
  </code></pre>
  
  <p><strong>Form Data</strong></p>
  
  <pre><code>ajax:1
  submit:1
  answer_question:1
  skip:0
  show_all:0
  targetid:123132212344212
  qid:2209
  is_new:1
  answers:2
  matchanswers:2
  importance:3
  is_public:1
  note:
  delete_note:0
  </code></pre>
  
  <p>Do you have any suggestion/idea where I am going wrong in my code ? </p>