Examples
twisted.web.client
httpclient.py- usetwisted.web.client.Agentto download a web page.(deprecated)
getpage.py- usetwisted.web.client.getPageto download a web page.(deprecated)
dlpage.py- add callbacks totwisted.web.client.downloadPageto display errors that occur when downloading a web page
XML-RPC
xmlrpcserver.pyXML-RPC server with several methods, including echoing, faulting, returning deferreds and failed deferredsxmlrpcclient.py- usetwisted.web.xmlrpc.Proxyto call remote XML-RPC methodsxmlrpc-debug.py- usexmlrpc.Proxy’squeryFactoryto debug raw XML-RPC trafficadvogato.py- usetwisted.web.xmlrpcto post a diary entry to advogato.org; requires an advogato account
Virtual hosts and proxies
proxy.py- usetwisted.web.proxy.Proxyto make the simplest proxylogging-proxy.py- example of subclassing the core classes oftwisted.web.proxyto log requests through a proxyreverse-proxy.py- usetwisted.web.proxy.ReverseProxyResourceto make any HTTP request to the proxy port get applied to a specified websiterootscript.py- example use oftwisted.web.vhost.NameVirtualHostweb.py- an example of both using theprocessorsattribute to set how certain file types are treated and usingtwisted.web.vhost.VHostMonsterResourceto reverse proxy
.rpys and ResourceTemplate
hello.rpy- usetwisted.web.staticto create a static resource to servefortune.rpy- create a resource that returns the output of a process run on the serverreport.rpy- display various properties of a resource, including path, host, and portusers.rpy- usetwisted.web.distribto publish user directories as for a “community web site”simple.rtl- example use oftwisted.web.resource.ResourceTemplate
Miscellaneous
webguard.py- pairingtwisted.webwithtwisted.credto guard resources against unauthenticated userssilly-web.py- bare-bones distributed web setup with a master and slave usingtwisted.web.distribandtwisted.spread.pbsoap.py- usetwisted.web.soapto publish SOAP methods