semvec/pypi-packages huggingface dataset:
aiohttp_exc_handlers 0.2
Bind views to exceptions for aiohttp
License: BSD
Keywords: asyncio,aiohttp

====================================
Bind views to exceptions for aiohttp
====================================

.. image:: https://travis-ci.org/zzzsochi/aiohttp_exc_handlers.svg?branch=master
  :target:  https://travis-ci.org/zzzsochi/aiohttp_exc_handlers
  :align: right

.. image:: https://coveralls.io/repos/zzzsochi/aiohttp_exc_handlers/badge.svg
  :target:  https://coveralls.io/github/zzzsochi/aiohttp_exc_handlers
  :align: right

-----
Usage
-----

.. code:: python

    import asyncio

    from aiohttp import web
    from aiohttp_exc_handlers import (
        exc_handlers_middleware,
        bind_exc_handler,
    )


    class CustomException(Exception):
        pass


    async def custom_exception_handler(request, exc):
        return web.Response(text="Hello, {!s}!".format(exc))


    async def hello(request):
        raise CustomException('world')


    # add middleware
    app = web.Application(middlewares=[exc_handlers_middleware])

    # bind handler to exception
    bind_exc_handler(app, CustomException, custom_exception_handler)

    app.router.add_route('GET', '/', hello)

    loop = asyncio.get_event_loop()
    handler = app.make_handler()
    f = loop.create_server(handler, '0.0.0.0', 8080)
    srv = loop.run_until_complete(f)

    try:
        loop.run_forever()
    except KeyboardInterrupt:
        pass
    finally:
        loop.run_until_complete(handler.finish_connections(1.0))
        srv.close()
        loop.run_until_complete(srv.wait_closed())
        loop.run_until_complete(app.finish())

    loop.close()


-----
Tests
-----

.. code:: shell

    $ pip install pytest
    $ py.test tests.py
Safe 0.4
Is your password safe?
License: BSD

Safe
====

Is your password safe? **Safe** will check the password strength for you.

.. image:: https://travis-ci.org/lepture/safe.png?branch=master
   :target: https://travis-ci.org/lepture/safe

How it works
------------

**Safe** will check if the password has a simple pattern, for instance:

1. password is in the order on your QWERT keyboards.
2. password is simple alphabet step by step, such as: abcd, 1357

**Safe** will check if the password is a common used password.
Many thanks to Mark Burnett for the great work on `10000 Top Passwords <https://xato.net/passwords/more-top-worst-passwords/>`_.

**Safe** will check if the password has mixed number, alphabet, marks.

Installation
------------

Install Safe with pip::

    $ pip install Safe

If pip is not available, try easy_install::

    $ easy_install Safe

Usage
-----

It's very simple to check the strength of a password::

    >>> import safe
    >>> safe.check(1)
    terrible
    >>> safe.check('password')
    simpile
    >>> safe.check('is.safe')
    medium
    >>> safe.check('x*V-92Ba')
    strong
    >>> strength = safe.check('x*V-92Ba')
    >>> bool(strength)
    True
    >>> repr(strength)
    'strong'
    >>> str(strength)
    'password is perfect'
    >>> strength.valid
    True
    >>> strength.strength
    'strong'
    >>> strength.message
    'good password'


Environ Variables
-----------------

1. **PYTHON_SAFE_WORDS_CACHE**: cache words in this file, default is a tempfile
2. **PYTHON_SAFE_WORDS_FILE**: words vocabulary file, default is the 10k top passwords

Other Implementations
---------------------

1. **JavaScript**: `lepture/safe.js <https://github.com/lepture/safe.js>`_