<commit_before>Snug
====

.. image:: https://img.shields.io/pypi/v/snug.svg
    :target: https://pypi.python.org/pypi/snug

.. image:: https://img.shields.io/pypi/l/snug.svg
    :target: https://pypi.python.org/pypi/snug

.. image:: https://img.shields.io/pypi/pyversions/snug.svg
    :target: https://pypi.python.org/pypi/snug

.. image:: https://travis-ci.org/ariebovenberg/snug.svg?branch=master
    :target: https://travis-ci.org/ariebovenberg/snug

.. image:: https://coveralls.io/repos/github/ariebovenberg/snug/badge.svg?branch=master
    :target: https://coveralls.io/github/ariebovenberg/snug?branch=master

.. image:: https://readthedocs.org/projects/snug/badge/?version=latest
    :target: http://snug.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

(Work in progress)

Wrap web APIs to fit nicely into your python code. Python >=3.6 only.

Quickstart
----------

.. code-block:: python

   import json
   import snug

   @snug.querytype()
   def repo(name: str, owner: str):
      """a repo lookup by owner and name"""
      request = snug.http.GET(f'https://api.github.com/repos/{owner}/{name}')
      response = yield request
      return json.loads(response.data)

  exec = snug.http.simple_exec()

Check the ``examples/`` directory for some samples.


Features
--------

- simple
- easy async support
<commit_msg>cleanup readme<commit_after>Snug
====

.. image:: https://img.shields.io/pypi/v/snug.svg
    :target: https://pypi.python.org/pypi/snug

.. image:: https://img.shields.io/pypi/l/snug.svg
    :target: https://pypi.python.org/pypi/snug

.. image:: https://img.shields.io/pypi/pyversions/snug.svg
    :target: https://pypi.python.org/pypi/snug

.. image:: https://travis-ci.org/ariebovenberg/snug.svg?branch=master
    :target: https://travis-ci.org/ariebovenberg/snug

.. image:: https://coveralls.io/repos/github/ariebovenberg/snug/badge.svg?branch=master
    :target: https://coveralls.io/github/ariebovenberg/snug?branch=master

.. image:: https://readthedocs.org/projects/snug/badge/?version=latest
    :target: http://snug.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

Wrap web APIs to fit nicely into your python code For python 3.5+.

Quickstart
----------

.. code-block:: python

   import json
   import snug

   @snug.querytype()
   def repo(name: str, owner: str):
      """a repo lookup by owner and name"""
      request = snug.http.GET(f'https://api.github.com/repos/{owner}/{name}')
      response = yield request
      return json.loads(response.data)

  exec = snug.http.simple_exec()

Check the ``examples/`` directory for some samples.

{'fraction_non_alphanumeric': 0.1725579627518054, 'fraction_numerical': 0.0015203344735841885, 'mean_word_length': 3.2588996763754046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 24, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2514078', 'n_tokens_mistral': 973, 'n_tokens_neox': 929, 'n_words': 163}