title: Python authenticate and launch private page using webbrowser, urllib and CookieJar
body: <p>I want to login with cookiejar and and launch not the login page but a page that can only be seen after authenticated. I know mechanize does that but besides not working for me now, I rather do this without it. Now I have,</p>
  
  <pre><code>import urllib, urllib2, cookielib, webbrowser
  from cookielib import CookieJar
  
  username = 'my_username'
  password = 'my_password'
  url = 'my_login_page'
  
  cj = cookielib.CookieJar()
  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  login_data = urllib.urlencode({'my_username' : username, 'my_password' : password})
  opener.open(url, login_data)
  page_to_launch = 'my_authenticated_url'
  webbrowser.open(page_to_launch, new=1, autoraise=1)
  </code></pre>
  
  <p>I am either able to login and dump the authenticated page to stdout, or launch the login page without recognizing the cookie, but I am not able to launch the page I want to after logging in. Help appreciated.</p>