Here are the examples of the python api twisted.web.resource.EncodingResourceWrapper taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
Project: splash Source File: mockserver.py
def __init__(self, original_children):
Resource.__init__(self)
try:
from twisted.web.server import GzipEncoderFactory
from twisted.web.resource import EncodingResourceWrapper
for path, child in original_children.items():
self.putChild(
path,
EncodingResourceWrapper(child, [GzipEncoderFactory()])
)
except ImportError:
pass
3
Example 2
Project: scrapy Source File: mockserver.py
def __init__(self):
Resource.__init__(self)
self.putChild(b"status", Status())
self.putChild(b"follow", Follow())
self.putChild(b"delay", Delay())
self.putChild(b"partial", Partial())
self.putChild(b"drop", Drop())
self.putChild(b"raw", Raw())
self.putChild(b"echo", Echo())
if twisted_version > (12, 3, 0):
from twisted.web.test.test_webclient import PayloadResource
from twisted.web.server import GzipEncoderFactory
from twisted.web.resource import EncodingResourceWrapper
self.putChild(b"payload", PayloadResource())
self.putChild(b"xpayload", EncodingResourceWrapper(PayloadResource(), [GzipEncoderFactory()]))
3
Example 3
Project: opencanary Source File: http.py
def getService(self):
page = BasicLogin(factory=self)
root = StaticNoDirListing(self.staticdir)
root.createErrorPages(self)
root.putChild("", RedirectCustomHeaders("/index.html", factory=self))
root.putChild("index.html", page)
wrapped = EncodingResourceWrapper(root, [GzipEncoderFactory()])
site = Site(wrapped)
return internet.TCPServer(self.port, site, interface=self.listen_addr)