<commit_before>#!/usr/bin/env python3
#
# Ex2 - Lonely Server
#

import asyncio

import growler


# Small function to handle requests from server
#
# This is typically a growler.App object, which handles the middleware chain
# and routing to endpoints.
#
@asyncio.coroutine
def handle_request(req, res):
    print("connection made by:", req)
    res.close()


http_server = growler.create_server(handle_request)
http_server.listen()
http_server.run_forever()
<commit_msg>Updated example2 with "modern" application interface<commit_after>#!/usr/bin/env python3
#
# Ex2 - Lonely Server
#

import asyncio
import growler


app = growler.App("Example2")

# Small function to handle requests from server
@app.get("/")
@asyncio.coroutine
def handle_request(req, res):
    print("connection made by:", req)
    yield from asyncio.sleep(2)
    res.send_text('')

app.create_server_and_run_forever(host='127.0.0.1', port=8000)

{'fraction_non_alphanumeric': 0.1134133042529989, 'fraction_numerical': 0.018538713195201745, 'mean_word_length': 4.922580645161291, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7115621', 'n_tokens_mistral': 314, 'n_tokens_neox': 300, 'n_words': 82}