Here is a simple script:
Code:
import httplib
import time
site = "www.mysite.com"
form = "/cgi-bin/form.py" #the path to the login form processor
username = "MyName"
password = "MyPassword"
form_data = "?USERNAMEFIELD=%s&PASSWORDFIELD=%s"%(username, password) #Change USERNAMEFIELD and PASSWORDFIELD for the form you are using
wait = 10 #Wait period 10 minutes if site is busy.
login_ok = "Thank you for logging in" # Some text that would be on the page if login was okay
while True:
conn = httplib.HTTPConnection(site)
conn.request("GET", form+form_data)
resp = conn.getresponse()
if resp.status == 404:
print "Webpage not found"
break
else:
data1 = resp.read()
print data1
if data1.find(login_ok) != -1:
print "Logged in"
break
else:
print "Trying again in ", wait, "minutes"
time.sleep(wait*60)
If you need help with this then please refer to the Python documentation.
grim