Response


The Response returns the union of frozenset x, y. 
from pyramid.response import Response

def frozenset1(request):
    x=frozenset({7,9,11,13})
    y=frozenset({5,10,15})
    z=frozenset.union(x,y)
    z=str(z)
    return Response('The union of frozenset is:' + z)
        
if __name__ == '__main__':
    config = Configurator()
    config.add_route('set', '/')
    config.add_view(frozenset1, route_name='set')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 1050, app)
    server.serve_forever()





The Response returns the union of frozenset x, y. 
from pyramid.response import Response

def frozenset1(request):
    x=frozenset({7,9,11,13})
    y=frozenset({5,10,15})
    z=frozenset.union(x,y)
    z=str(z)
    return Response('The union of frozenset is:' + z)
        
if __name__ == '__main__':
    config = Configurator()
    config.add_route('set', '/')
    config.add_view(frozenset1, route_name='set')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 1050, app)
    server.serve_forever()






The pyramid returns with the requests after finding the number of 'a' in www.pythonlake.com.
from wsgiref.simple_server import make_server
from pyramid.response import Response
import requests

def find(request):
    r=requests.get('http://www.pythonlake.com')
    text=r.text
    f=text.find('a')
    f=str(f)
    response = Response()
    response.text=f
    return response
    
if __name__ == '__main__':
    config = Configurator()
    config.add_route('find', '/')
    config.add_view(find, route_name='find')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6500, app)
    server.serve_forever()





Comments