Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib
- import urllib2
- from cookielib import CookieJar
- #make a cookie and redirect handlers
- cookies = CookieJar()
- cookie_handler= urllib2.HTTPCookieProcessor(cookies)
- redirect_handler= urllib2.HTTPRedirectHandler()
- opener = urllib2.build_opener(redirect_handler,cookie_handler)#make opener w/ handlers
- #build the url
- login_info = {'username':USER,'password':PASS}#USER and PASS are defined
- data = urllib.urlencode(login_info)
- req = urllib2.Request("http://www.hulu.com/account/authenticate",data)#make the request
- test = opener.open(req) #open the page
- print test.read() #print html results
- Login.onError("Please 74a href="/support/login_faq#cant_login"