Does cyclone (python) support HTTPS connections and SSL? If so, can you please provide an example?
I've looked through the documentation and code on the cyclone github page, and can't find any reference to SSL. But since lots of cyclone is just wrapping twisted, maybe there's something I'm missing...
SSL examples have been added after I found this post. It's here: https://github.com/fiorix/cyclone/tree/master/demos/ssl
From the README:
cyclone is a Twisted protocol, therefore it may be used in conjunction with any other protocol implemented in Twisted.
If Twisted supports SSL then cyclone supports it e.g.:
#file: cyclone-ssl.py
import cyclone.web
class IndexHandler(cyclone.web.RequestHandler):
def get(self):
self.write("hello world")
factory = cyclone.web.Application([(r"/", IndexHandler)])
portstr = "ssl:4443:privateKey=server_key.pem:certKey=server_cert.pem"
# make twisted app
from twisted.application import service, strports
application = service.Application("cyclone-ssl")
strports.service(portstr, factory).setServiceParent(application)
Run it as:
$ twistd -ny cyclone-ssl.py
The part that activates ssl is portstr
. It specifies that the server serves on 4443
port and uses server_key.pem
as its private key, server_cert.pem
as a certificate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With