Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.6
- # -*- coding: utf-8 -*-
- import urllib
- import urllib2
- # build opener with HTTPCookieProcessor
- o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
- urllib2.install_opener( o )
- p = urllib.urlencode( { 'username': 'tuouser', 'password': 'tuapass', 'provider': 'LDAP-Studenti' } )
- # perform login with params
- f = o.open( 'https://auth3.unipi.it/auth/perfigo_cm_validate.jsp', p )
- data = f.read()
- f.close()
- p = urllib.urlencode( { 'username': 'tuouser', 'password': 'tuapass', 'provider': 'LDAP-Studenti', 'remove_old': '1' } )
- # perform login with params
- f = o.open( 'https://auth3.unipi.it/auth/perfigo_cm_validate.jsp', p )
- data = f.read()
- f.close()
- # second request should automatically pass back any
- # cookies received during login... thanks to the HTTPCookieProcessor
- f = o.open( 'http://www.google.it' )
- data = f.read()
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement