title: python requests handle error 302?
body: <p>I am trying to make a http request using <code>requests</code> library to the redirect url (in response headers-Location). When using Chrome inspection, I can see the response status is 302. </p>
  
  <p>However, in python, <code>requests</code> always returns a 200 status. I added the <code>allow_redirects=False</code>, but the status is still always 200. </p>
  
  <ul>
  <li>The url is <code>https://api.weibo.com/oauth2/authorize?redirect_uri=http%3A//oauth.weico.cc&amp;response_type=code&amp;client_id=211160679</code></li>
  <li>the first line entered the test account: <code>moyan429@hotmail.com</code></li>
  <li>the second line entered the password: <code>112358</code></li>
  </ul>
  
  <p>and then click the first button to login.</p>
  
  <p>My Python code:</p>
  
  <pre><code>import requests
  
  user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36'
  session = requests.session()
  session.headers['User-Agent'] = user_agent
  session.headers['Host'] = 'api.weibo.com'
  session.headers['Origin']='https://api.weibo.com'
  session.headers['Referer'] ='https://api.weibo.com/oauth2/authorize?redirect_uri=http%3A//oauth.weico.cc&amp;response_type=code&amp;client_id=211160679'
  session.headers['Connection']='keep-alive'
  
  data = {
      'client_id': api_key,
      'redirect_uri': callback_url,
      'userId':'moyan429@hotmail.com',
      'passwd': '112358',
      'switchLogin': '0',
      'action': 'login',
      'response_type': 'code',
      'quick_auth': 'null'
  }
  
  resp = session.post(
      url='https://api.weibo.com/oauth2/authorize',
      data=data,
      allow_redirects=False
  )
  code = resp.url[-32:]
  print code
  </code></pre>