title: Using python to submit a web form with liburl or requests
body: <p>I am trying to submit a form on the <a href="https://fcq.colorado.edu/UCBdata.htm" rel="nofollow">webpage</a> and get to the html of the next page after the form is submitted. I found two ways of doing this using either requests or liburl.</p>
  
  <pre><code>import urllib
  import urllib2
  import webbrowser
  
  url = 'https://fcq.colorado.edu/UCBdata.htm'
  
  def main():
      data = urllib.urlencode({'subj': 'CSCI', 'crse': '1300'})
      results = urllib2.urlopen(url, data)
      print results.read()
      with open("results.html", "w") as f:
          f.write(results.read())
  
      webbrowser.open("results.html")
      return 0
  
   if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>import requests
  
  url = 'https://fcq.colorado.edu/UCBdata.htm'
  
  def main():     
      payload = {'subj': 'CSCI', 'crse': '1300'}
      r = requests.post(url, payload)
      with open("requests_results.html", "w") as f:
          f.write(r.content)  
      return 0
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>When I get the page after the request it is just the same page that has the form on it for both methods. I was wondering if I maybe had to do something with the submit button? I am new to web stuff and python so any tips or ideas would be greatly appreciated. Thanks!</p>
  
  <p>Here is the html of the submit button:</p>
  
  <p><code>&lt;input type="submit" name="sub" value="Submit Request" onclick="this.disabled=true,this.form.submit();"&gt;</code></p>