title: Session timeout in Python
body: <p>Here is the code I am working with.</p>
  
  <pre><code>import requests
  
  headers = { 'Accept':'*/*',
              'Accept-Language':'en-US,en;q=0.8',
              'Cookie':'Cookie:PHPSESSID=vev1ekv3grqhh37e8leu1coob1',
              'Cache-Control':'max-age=0',
              'Connection':'keep-alive',
              'Proxy-Authorization':'Basic ZWRjZ3Vlc3Q6ZWRjZ3Vlc3Q=',
              'If-Modified-Since':'Fri, 13 Nov 2015 17:47:23 GMT',
              'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36'
              }
  
  
  with requests.Session() as c:
      url = 'http://172.31.13.135/tpo/spp/'
      c.get(url, headers=headers)
      payload = {'regno': 'myregno', 'password': 'mypassword'}
      c.post(url, data = payload, headers=headers)
      r = c.get('http://172.31.13.135/tpo/spp/home.php', headers=headers)
      print r.content
  </code></pre>
  
  <p>I get the following message when I run this script.</p>
  
  <pre><code>&lt;script&gt;
  alert("Session timeout !");
  window.location = "logout.php";
  &lt;/script&gt;&lt;script&gt;
  alert("Unauthorised Access!");
  window.location = "index.php";
  &lt;/script&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  </code></pre>
  
  <p>How do I deal with this "session timeout" issue ?</p>
  
  <p>Many thanks in advance.</p>