import urllib import urllib2 import cookielib username = raw_input("Username: ") password = raw_input("Password: ") cookieJar = cookielib.LWPCookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookieJar)) opener.addheaders = [('User-agent', "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20061201 Firefox/2.0.0.4 (Ubuntu-feisty)")] form = { "username" : username, "password" : password } encodedForm = urllib.urlencode(form) url = "http://www.neopets.com/login.phtml" request = urllib2.Request(url, encodedForm) page = opener.open(request) contents = page.read() if "logout" in contents: print "logged in"
{Python} Is this the correct way to login to neopets?
#1
Posted 15 November 2009 - 11:24 AM
#2
Posted 15 November 2009 - 12:06 PM
One question, wheres the postdata?
and make sure you go to the Login page, enter username, check for errors, then enter password, check for errors, and yeah that should be it.
Also, if you notice in livehttpheaders at the end of each login URL there is "&x=#&y=#"
make sure to have a function make a random number between 0 and 40 in those #s.
#3
Posted 15 November 2009 - 12:18 PM
I cant make anything with python but I think i can read it...
One question, wheres the postdata?
and make sure you go to the Login page, enter username, check for errors, then enter password, check for errors, and yeah that should be it.
Also, if you notice in livehttpheaders at the end of each login URL there is "&x=#&y=#"
make sure to have a function make a random number between 0 and 40 in those #s.
If I don't have those will I get banned?
#4
Posted 15 November 2009 - 12:37 PM
#5
Posted 15 November 2009 - 12:47 PM
Theres not really a guarantee but its just safe to do so, most modern programs do this and i think so does NeoCodex programs (that is if you didnt move your cookies from your browser to the program)
the program stores cookies
#6
Posted 15 November 2009 - 02:52 PM
Also, you are using a really old browser User-Agent from Linux. I would update that.
#7
Posted 15 November 2009 - 03:36 PM
destination=%2Findex.phtml
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users