I am trying to execute the check_server_certificate.py and I am getting this error… can you guys help me figure out whats going on? its the exact sample code on the website running on Ubuntu 14.04.
Here is the error output: Traceback (most recent call last): File "check_server_certificate.py", line 28, in <module> task.react(main, sys.argv[1:]) File "/usr/lib/python2.7/dist-packages/twisted/internet/task.py", line 867, in react finished = main(_reactor, *argv) File "check_server_certificate.py", line 6, in main options = ssl.optionsForClientTLS(hostname=host.decode('utf-8')) AttributeError: 'module' object has no attribute 'optionsForClientTLS' Here is the code (check_server_certificate.py): from __future__ import print_function import sys from twisted.internet import defer, endpoints, protocol, ssl, task, error def main(reactor, host, port=443): options = ssl.optionsForClientTLS(hostname=host.decode('utf-8')) port = int(port) class ShowCertificate(protocol.Protocol): def connectionMade(self): self.transport.write(b"GET / HTTP/1.0\r\n\r\n") self.done = defer.Deferred() def dataReceived(self, data): certificate = ssl.Certificate(self.transport.getPeerCertificate()) print("OK:", certificate) self.transport.abortConnection() def connectionLost(self, reason): print("Lost.") if not reason.check(error.ConnectionClosed): print("BAD:", reason.value) self.done.callback(None) return endpoints.connectProtocol( endpoints.SSL4ClientEndpoint(reactor, host, port, options), ShowCertificate() ).addCallback(lambda protocol: protocol.done) task.react(main, sys.argv[1:]) Rudy Aramayo | Developer | OrbitusRobotics LLC Direct: 626.386.8329 | Email: orbi...@orbitusrobotics.com | Web: www.orbitusrobotics.com "This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify me (orbi...@orbitusrobotics.com). If you are not the named addressee you should not disseminate, distribute or copy this e-mail and should delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.”
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python