title: How to retrieve data from a iframe on a HTTPS secured site with a login
body: <p>I have been trying to make a script, that will enable me to grab my grades from our online internal webpage. </p>
  
  <p>The page i want to retrieve data from is <a href="https://sb.stads.ku.dk/SB_PSTA/sb/resultater/studresultater.jsp" rel="nofollow">https://sb.stads.ku.dk/SB_PSTA/sb/resultater/studresultater.jsp</a></p>
  
  <p>I have tried doing this in Python. But whenever i get logged in, i don't know how to get to this page in the script. Simply accessing the page is not enough. It seems as if i get redirected after logging in. </p>
  
  <p>Here is what i have so far.</p>
  
  <pre><code>import urllib2
  
  theurl = 'https://intranet.ku.dk/Selvbetjening/Sider/default.aspx'
  username = 'MYUSERNAME'
  password = 'MYPASSWORD'
  
  passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
  passman.add_password(None, theurl, username, password)
  
  authhandler = urllib2.HTTPBasicAuthHandler(passman)
  opener = urllib2.build_opener(authhandler)
  urllib2.install_opener(opener)
  
  pagehandle = urllib2.urlopen(theurl)
  
  for elm in pagehandle: 
      print elm
  </code></pre>
  
  <p>Thank you!</p>