title: Python requests post login failed with page expired
body: <p>I am trying to retrieve some html text behind a login page using <strong>python requests Post</strong>. But my code fails to do so with return html containing <code>.... The page has expired due to inactivity.</code>.</p>
  <p>Below is my code.</p>
  <pre class="lang-py prettyprint-override"><code>import requests 
  
  url_login = u&quot;https://savethewater-game.com/login&quot; 
  
  headers = {
    'referer': 'https://savethewater-game.com/login',
    'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
  }
  
  payload = {
      '_token': u'mUaaXNup3vCEtiln5QeQNJNwoO8LrCH9opoVE4GH',
      'email': u'someone@gmail.com', # fake email
      'password': u'12345678' # fake pass
  }
  
  with requests.Session() as session:
      p = session.post(url_login, headers=headers, data=payload)
      print(p.text)
  </code></pre>
  <p>The intercepted login value in Chrome dev tool is shown below:</p>
  <pre><code>:authority: savethewater-game.com
  :method: POST
  :path: /login
  :scheme: https
  accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
  accept-encoding: gzip, deflate, br
  accept-language: en,it;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6,en-US;q=0.5
  cache-control: max-age=0
  content-length: 93
  content-type: application/x-www-form-urlencoded
  cookie: XSRF-TOKEN=eyJpdiI6ImtvRW5UT1BMNjkxNVFBc1d2OVJKZ3c9PSIsInZhbHVlIjoicVVCYlhFRG50QmVKd3V1Yzh4NnNldUhvRXpZOWVSRDFiUGNsT1E4aG9oOUFpYlZ0M1BaRFwvR3VkK1Q4MkhLOFlBZDlxUWp4R0s4YjU4aTZGc0I0RVZ3PT0iLCJtYWMiOiIzYzMxMmI0ZjlhOTM0YzVjZjA5NDk2MDkxMDJlY2VlMjVmNjhiYTJiM2E2OTlkYmYzOTIyYzJiYTM0NTJhMWMyIn0%3D; savethewater_session=eyJpdiI6IjltY2M3alp2endPdWY4VmVpNGhKMXc9PSIsInZhbHVlIjoiVjR2T2lHempPVGM1YW04YldtbGkxcWU3TlwvU1N2RTRcL0VoMzFPY2RLb245bXo0bVJreDl0UnBMYlFjaDNOZlZlMEQ2YVpKVXU3QVYxWWRGNW13bE9wdz09IiwibWFjIjoiNjk0YTdmNTFmYzJiMzg2MDA3NmRiOGU5OTUwMWVkMDE3ZmRkZDY1NzUzMjVjMTYxNzljNjNlZTc4NzE5ODYyNiJ9
  origin: https://savethewater-game.com
  referer: https://savethewater-game.com/login
  sec-fetch-mode: navigate
  sec-fetch-site: same-origin
  sec-fetch-user: ?1
  upgrade-insecure-requests: 1
  user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
  </code></pre>
  <p>Some posts mentioned that the reason could be the block of website from automatic <strong>scraping</strong>. I would like to know if mine codes went wrong or some other issues. Very much thanks!</p>