# -*- coding: cp1252 -*- ######################################################################################################### # This is a Plugin to get the registered members from a site for Clan Checker for Soul Wars Unleashed. # written by Aesus1 # # Note that this script uses the mechanize browser # ######################################################################################################### #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Site Funtions #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## Function: Login ===================================================================================== # syntax: Login (arg1) # success: returns an 1 # failure: returns a -2 for a navigation error and -1 for any other error + deletes the bad entry #======================================================================================================== def Site_Login(arg1):#arg2): br = arg1[0] # mechanize browser object username = arg1[1] password = arg1[2] try: debug = arg1[3] except: debug = 0 import urllib #needed for url encoding of login values login_url = 'http://s1.zetaboards.com/swunleashed/login/log_in' login_values = {'uname' : username, 'pw' : password, 'submit' : '1', 'cookie_on' : '1'} login_data = urllib.urlencode(login_values) try: response1 = br.open(login_url, login_data) HTMLSource1 = response1.read() response1.close() #not really needed except: print "Error opening page" return -2 else: # this stores a copy of the login result page when debugging is set to 1 in the ini file # Its handy when troubleshooting errors if str(debug) == "1": f = file('SWU_login.html', 'w') f.write(HTMLSource1) f.close() # Verify Login Attempt Successful success_string = "Welcome ', '') HTMLSource1 = HTMLSource1.replace("for(i=0;i', pos1) numpages = lp_line[pos1 + len('