Se è cosi penso che devi anche gestire i cookie per tenerti loggato,ho trovato un esempio:
Non ho idea se funzionicodice:import urllib2, cookielib, re url = 'http://secure.myspace.com/index.cfm?fuseaction=login.process' email = "" #put your email address here pwd = "" #put your password here data = "__VIEWSTATE=%2FwEPDwUKLTY1Mjc2MTMwMWQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgIFPWN0bDAwJGN0bDAwJE1haW4kY3BNYWluJFNwbGFzaERpc3BsYXkkY3RsMDAkUmVtZW1iZXJfQ2hlY2tib3gFPWN0bDAwJGN0bDAwJE1haW4kY3BNYWluJFNwbGFzaERpc3BsYXkkY3RsMDAkTG9naW5fSW1hZ2VCdXR0b24%3D&NextPage=&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24Email_Textbox="+email+"&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24Password_Textbox="+pwd+"&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24Login_ImageButton.x=36&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24Login_ImageButton.y=15&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24nexturl=&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24apikey=&ctl00%24ctl00%24Main%24cpMain%24SplashDisplay%24ctl00%24ContainerPage=" cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) opener.addheaders = [('Referer', 'http://www.myspace.com/index.cfm?fuseaction=splash'), ('Content-Type', 'application/x-www-form-urlencoded'), ('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14')] usock = opener.open(url, data) the_page = usock.read() usock.close()![]()

Rispondi quotando