<commit_before>aiorest
=======

JSON REST framework based on aiohttp (an asyncio (PEP 3156) http server).

.. image:: https://travis-ci.org/aio-libs/aiorest.svg?branch=master
   :target: https://travis-ci.org/aio-libs/aiorest


Example usage
-------------

Simple REST server can be run like this:

.. code:: python

   import asyncio
   import aiohttp
   import aiorest


   # define a simple request handler
   # which accept no arguments
   # and responds with json
   def hello(request):
       return {'hello': 'world'}


   loop = asyncio.get_event_loop()
   server = aiorest.RESTServer(hostname='127.0.0.1',
                               loop=loop)

   # configure routes
   server.add_url('GET', '/hello', hello)
   # create server
   srv = loop.run_until_complete(loop.create_server(
       server.make_handler, '127.0.0.1', 8080))


   @asyncio.coroutine
   def query():
       resp = yield from aiohttp.request(
           'GET', 'http://127.0.0.1:8080/hello', loop=loop)
       data = yield from resp.read_and_close(decode=True)
       print(data)


   loop.run_until_complete(query())
   srv.close()
   loop.run_until_complete(srv.wait_closed())
   loop.close()

this will print ``{'hello': 'world'}`` json

See `examples <https://github.com/aio-libs/aiorest/tree/master/examples>`_ for more.


Requirements
------------

- Python 3.3

- asyncio http://code.google.com/p/tulip/ or Python 3.4+

- aiohttp http://github.com/KeepSafe/aiohttp

- optional module ``aiorest.redis_session`` requires aioredis
  https://github.com/aio-libs/aioredis

License
-------

aiorest is offered under the MIT license.
<commit_msg>reverted nice code highlight in sake of 'check -rms' to pass<commit_after>aiorest
=======

JSON REST framework based on aiohttp (an asyncio (PEP 3156) http server).

.. image:: https://travis-ci.org/aio-libs/aiorest.svg?branch=master
   :target: https://travis-ci.org/aio-libs/aiorest


Example usage
-------------

Simple REST server can be run like this::

   import asyncio
   import aiohttp
   import aiorest


   # define a simple request handler
   # which accept no arguments
   # and responds with json
   def hello(request):
       return {'hello': 'world'}


   loop = asyncio.get_event_loop()
   server = aiorest.RESTServer(hostname='127.0.0.1',
                               loop=loop)

   # configure routes
   server.add_url('GET', '/hello', hello)
   # create server
   srv = loop.run_until_complete(loop.create_server(
       server.make_handler, '127.0.0.1', 8080))


   @asyncio.coroutine
   def query():
       resp = yield from aiohttp.request(
           'GET', 'http://127.0.0.1:8080/hello', loop=loop)
       data = yield from resp.read_and_close(decode=True)
       print(data)


   loop.run_until_complete(query())
   srv.close()
   loop.run_until_complete(srv.wait_closed())
   loop.close()

this will print ``{'hello': 'world'}`` json

See `examples <https://github.com/aio-libs/aiorest/tree/master/examples>`_ for more.


Requirements
------------

- Python 3.3

- asyncio http://code.google.com/p/tulip/ or Python 3.4+

- aiohttp http://github.com/KeepSafe/aiohttp

- optional module ``aiorest.redis_session`` requires aioredis
  https://github.com/aio-libs/aioredis

License
-------

aiorest is offered under the MIT license.

{'fraction_non_alphanumeric': 0.14677222898903775, 'fraction_numerical': 0.020706455542021926, 'mean_word_length': 2.8466042154566744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '162174', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1077, 'n_words': 256}