title: Signing into website with Python with hidden form fields
body: <p>I'm trying to sign into a website via a python script but I cannot get this to work.</p>
  <p>I'm using requests and BeautifulSoup.</p>
  <p>This is the code I've been trying to use:</p>
  <pre class="lang-py prettyprint-override"><code>import requests
  from bs4 import BeautifulSoup
  
  login_url = 'url_here'
  
  payload = {
      'UserName': 'username',
      'Password': 'password'
  }
  
  with requests.session() as s:
      r = s.post(login_url, data=payload)
      soup = BeautifulSoup(r.content, 'html5lib')
      print(soup.prettify())
  </code></pre>
  <p>The code above prints only the HTML for the login page, so it doesn't seem to be doing anything. Is there a way to find out what I'm missing?</p>