requests.get.find


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