Hello,
Most of the PITA sites that I would like to automate all check
the browser version (to make sure that their flavor of JavaScript
will be accepted). I saw the agent command, I saw that it
had commented code, I hacked it. Worked for me, YMMV.
HTH,
William
cd ~/tools/python/twill-0.8/twill/
diff -u /home/wkv/tools/python/twill-0.8/twill/browser.py\~ /home/wkv/tools/python/twill-0.8/twill/browser.py
--- /home/wkv/tools/python/twill-0.8/twill/browser.py~ 2005-11-05 22:35:56.000000000 -0700
+++ /home/wkv/tools/python/twill-0.8/twill/browser.py 2005-11-09 21:51:26.941773316 -0700
@@ -207,7 +207,11 @@
Set the agent string to the given value.
"""
# currently doesn't work.
- # self._browser.set_persistent_headers([("User-agent", agent)])
+ for i in xrange(len(self._browser.addheaders)):
+ if self._browser.addheaders[i][0] == "User-agent":
+ del self._browser.addheaders[i]
+ break
+ self._browser.addheaders +=[("User-agent", agent)]
def showforms(self):
"""
Diff finished at Wed Nov 9 22:30:44
_______________________________________________
twill mailing list
[email protected]
http://lists.idyll.org/listinfo/twill