title: Python Login into an website with requests
body: <p>Im tryin to login into this page with python and requests via post methode:
  <a href="http://pastebin.com/eD9Wc4TS" rel="nofollow">http://pastebin.com/eD9Wc4TS</a>
  <em>(the javascript in script.js: <a href="http://pastebin.com/Cd2DRrEn" rel="nofollow">http://pastebin.com/Cd2DRrEn</a>)</em></p>
  
  <p>Here's what I tried:</p>
  
  <pre><code>import requests
  
  headers = {'User-Agent': 'Mozilla/5.0'}
  payload = {'page':'','pass':'4376','ID':'2'} #login data
  print payload
  link    = 'http://abi16.rsgohlis.de/login.php'
  session = requests.Session() #session
  
  resp    = session.post(link,headers = headers,data = payload) #forgot payload
  resp = session.get('http://abi16.rsgohlis.de/home.php')
  
  print resp.content
  </code></pre>
  
  <p>But everytime I try it leads me back to the starting page saying that I'm not logged in(although using the right combination). It'd be enough for me if the website would response with </p>
  
  <blockquote>
    <p>Das Passwort ist leider falsch.</p>
  </blockquote>
  
  <p><em>(which is german for <strong>wrong password</strong>)</em></p>
  
  <p>But it only responds by stating</p>
  
  <blockquote>
    <p>Du musst angemeldet sein, um diese Seite sehen zu können.</p>
  </blockquote>
  
  <p><em>(which is german again for <strong>you must be logged in to see this page</strong>)</em></p>
  
  <p>My question is, how to keep up the session to really login and at least get the login error?</p>
  
  <p><strong>Edit:</strong> As @juvian pointed out, I forgot to add the payload. However, nothing changed in the end unfortunately.</p>