[pyar] mechanize, SSL y client cert+key

Ezequiel Gutesman egutesman en gmail.com
Jue Nov 22 17:06:35 ART 2012


Hola a todos,

Estoy intentando abrir un site que suele usar un certificato .p12 que tengo
instalado en el browser.

Extraje el cert y la key (.pem) ambos sin password, y se los agregué a la
instancia de mechanize:

>>> b.add_client_certificate(<URL>,"./cert.pem", "./privkey.pem")

despues le dije que traiga la URL:

r = b.open(<URL+un path dentro del dominio>)

y me da


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_mechanize.py",
line 203, in open
    return self._mech_open(url, data, timeout=timeout)
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_mechanize.py",
line 230, in _mech_open
    response = UserAgentBase.open(self, request, data)
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_opener.py",
line 193, in open
    response = urlopen(self, req, data)
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_urllib2_fork.py",
line 344, in _open
    '_open', req)
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_urllib2_fork.py",
line 332, in _call_chain
    result = func(*args)
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_urllib2_fork.py",
line 1170, in https_open
    return self.do_open(conn_factory, req)
  File
"/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_urllib2_fork.py",
line 1118, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 336265225] _ssl.c:351:
error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib>


Alguna idea? los files no tienen mas que el cert y la key...
gracias
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20121122/646e2d17/attachment.html>


More information about the pyar mailing list