On Jun 8, 12:58 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
On Mon, 08 Jun 2009 12:14:18 +0100, Mark Devine wrote:
Hi
I wonder if someone could point me in the right direction. I used the
following code to access gmail but I got a
urllib2.URLError: urlopen error unknown url type: 'http
error when I ran it. I have included the Traceback
import twill, string, os
b=twill.commands.get_browser()
b.set_agent_string(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14) b.clear_cookies()
b.go('http://www.gmail.com')
f=b.get_form(1)
b.showforms()
f['Email']= email
f['Passwd'] =password
b.clicked(f, f)
b.submit()
My bet is that the above is not the actual code you have run. I bet that
the offending line is actually something like the following:
b.go('http://www.gmail.com;)
Note that there is a single character difference.
Consider the last two lines of the traceback:
raise URLError('unknown url type: %s' % type)
urllib2.URLError: urlopen error unknown url type: 'http
It seems to be saying that the url type is 'http -- note the leading
single quote.
--
Steven
Actually that is the exact code run from a python shell. Try it
yourself. I could not find anybody who successfully automated sending
a gmail through python with twill so if you know how I would greatly
appreciate any pointers.
--
http://mail.python.org/mailman/listinfo/python-list