title: Login and send form not working with requests
body: <p>I've written code for a programming mission 2 on <strong>hackthissite</strong>, just some fun and to practice coding etc. I have completed the mission, but I was unable to get Python to login using the <code>requests</code> library and upload my code to the form automatically.</p>
  
  <p>Here is a snippet from my code with the code that is not working and still says <em>"you need to login"</em> in page content:</p>
  
  <pre><code>def upload_code(key):
      login_url = 'https://www.hackthissite.org/user/login'
      btn_submit = 'Login'
      username = 'example_username'
      password = 'example_password'
      login = {
          'btn_submit': btn_submit,
          'password': password,
          'username': username,
      }
  
      session = requests.session()
      header_auth = {
          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko',
          'referer': 'www.hackthissite.org/user/login'
      }
      auth = session.post(login_url, headers=header_auth, data=login)
  
      challange_url = 'https://www.hackthissite.org/missions/prog/2/index.php'
      header = {'referer': 'www.hackthissite.org/missions/prog/2/index.php'}
      data = {'solution': key}
  
      r = session.post(challange_url, headers=header, data=data, verify=True)
      print(r.content)
  </code></pre>
  
  <p>If anyone can tell me what I'm doing wrong, I would be very appreciative. </p>