Does the cyclone (python) support HTTPS connections and SSL?

Does the cyclone (python) support HTTPS connections and SSL? If so, can you give an example?

I looked through the documentation and code on the github cyclone page and cannot find the SSL link. But since many cyclones just wrap themselves around, maybe something is missing for me there ...

+5
source share
2 answers

From README :

Cycle

- This is a twisted protocol, so it can be used in conjunction with any other protocol implemented in Twisted.

If Twisted supports SSL, then the cyclone supports it, for example:

#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

, ssl, portstr. , 4443 server_key.pem , server_cert.pem .

+2

All Articles