March 2019
Beginner
490 pages
12h 40m
English
Twisted contains a series of classes and utilities to create various types of servers and clients. It is possible to create configurations for web servers and configurations to use the SSL protocol between clients and servers. In this example, we are developing a server that receives HTTP requests.
You can find the following code in the twisted_web_server.py file:
#!/usr/bin/env python3from twisted.internet import reactorfrom twisted.web import server, resourceclass TwistedResource(resource.Resource): def render_GET(self, request): return b"<html><center><h1>Twisted server is running on port 8080</h1></center></html>"root = resource.Resource()root.putChild(b"twisted", TwistedResource())site = server.Site(root) ...
Read now
Unlock full access