title: How to maintain login session while logging in using Python Script
body: <p>I want to login to Ideone.com using python script and then extract stuff from my own account using subsequent requests using python script.
  This is what I used for logging in to the website:</p>
  
  <pre><code>import requests
  import urllib
  from bs4 import BeautifulSoup
  
  url='http://ideone.com/account/login/'
  body = {'username':'USERNAME', 'password':'PASSWORD'}
  
  s = requests.Session()
  loginPage = s.get(url)
  soup = BeautifulSoup(loginPage.text)
  
  r = s.post(soup.form['action'], data = body)
  print r
  </code></pre>
  
  <p>This code successfully logs me in to my ideone account.
  But if I make subsequent call(using BeautifulSoup) to access my account details, it send me HTML of login page again.</p>
  
  <p>How can I save session for a particular script so that it accepts the subsequent calls?
  Thanks in advance and sorry if this has been asked earlier.</p>