Hi there,
I am trying to open an https site and pass a request to it in order to
simulate the submit of an HTML form on a https site that sets an
authentication cookie for a tomcat application, so the the URL I am
trying to open points to a web form provided by the tomcat webserver.
I tried (Python 2.3.5):
[color=blue][color=green][color=darkred]
>>> import urllib
>>> import urllib2
>>> the_url = "https://myserver/application/login.do"
>>> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
>>> headers = { 'User-Agent' : user_agent }
>>> values = { 'username' : 'myuser', 'password' : 'mypasswd' }
>>> data = urllib.urlencod e(values)
>>> req = urllib2.Request (the_url, data)
>>> handle = urllib2.urlopen (req)[/color][/color][/color]
This raises the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/urllib2.py", line 129, in urlopen
return _opener.open(ur l, data)
File "/usr/local/lib/python2.3/urllib2.py", line 331, in open
'unknown_open', req)
File "/usr/local/lib/python2.3/urllib2.py", line 306, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.3/urllib2.py", line 914, in unknown_open
raise URLError('unkno wn url type: %s' % type)
urllib2.URLErro r: <urlopen error unknown url type: https>
Any idea, what I did wrong?
Regards,
Nico
I am trying to open an https site and pass a request to it in order to
simulate the submit of an HTML form on a https site that sets an
authentication cookie for a tomcat application, so the the URL I am
trying to open points to a web form provided by the tomcat webserver.
I tried (Python 2.3.5):
[color=blue][color=green][color=darkred]
>>> import urllib
>>> import urllib2
>>> the_url = "https://myserver/application/login.do"
>>> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
>>> headers = { 'User-Agent' : user_agent }
>>> values = { 'username' : 'myuser', 'password' : 'mypasswd' }
>>> data = urllib.urlencod e(values)
>>> req = urllib2.Request (the_url, data)
>>> handle = urllib2.urlopen (req)[/color][/color][/color]
This raises the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/urllib2.py", line 129, in urlopen
return _opener.open(ur l, data)
File "/usr/local/lib/python2.3/urllib2.py", line 331, in open
'unknown_open', req)
File "/usr/local/lib/python2.3/urllib2.py", line 306, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.3/urllib2.py", line 914, in unknown_open
raise URLError('unkno wn url type: %s' % type)
urllib2.URLErro r: <urlopen error unknown url type: https>
Any idea, what I did wrong?
Regards,
Nico