dear tutors, I'm trying to use a GPS tracking service called InstaMapper. The service changes how frequently it updates the tracking device's position based on whether the UI is being accessed on the InstaMapper webpage. I'd like to have the increased update frequency happen all the time so I thought I'd write a python script to login to my account and access the page periodically:
import urllib2, urllib, cookielib cj = cookielib.LWPCookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) params = urllib.urlencode(dict(username_hb='user', password_hb='resu')) opener.open('http://www.instamapper.com/fe?action=login', params) if not 'id' in [cookie.name for cookie in cj]: raise ValueError, "Login failed" # now try secured page resp = opener.open('http://www.instamapper.com/fe?page=track&device_key=abc ') print resp.read() resp.close() The ValueError is raised each time. If I remove this and read the response, the page thinks I have disabled cookies and blocks access. Why isn't cj grabbing the InstaMapper cookie? Are there better ways to make the tracking service think I'm viewing my account constantly? -Matt
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor