semvec/pypi-packages huggingface dataset:
async-services 1.0.2
Synchronus Wrapper for Async Code
License: MIT

# Async Services

[![Build Status](https://travis-ci.org/gekco/async_services.svg?branch=master)](https://travis-ci.org/gekco/async_services)

Run fast asynchronous code from a synchronous code. Async Services provide a synchronous wrapper to run
third party asynchronous code or any coroutine for that matter in a synchronous way from a synchronous code.

### Installation

```
pip install async_services
```

## For Development Purposes
Install project Dependencies
```
pip install -r requirements.txt
```

```
pip install -U .
```

## Running the tests

You can run the tests with the following command

```
pytest .
```

### And coding style tests

```
pycodestyle .
```

### Example Usage

```
from async_services.core import run_coro, run_manager, stop_manager
from async_services.core.manager import CoroStatus
import asyncio

async def coroutine(seconds=1, raise_exception=False):
    await asyncio.sleep(seconds)
    if raise_exception:
        raise Exception("Sample Exception")
    return "Hello World"

run_manager()
result = run_coro(coroutine(), block=True)
print(result)
assert result[0] == CoroStatus.Completed
assert result[1] == "Hello World"
stop_manager()

```
## Output
Result will be a tuple consisting of two values (status, result)
status will be a integer between 0 and 5 and it defines the state of the coruotine

```
(1, 'Hello World')
```

## Coroutine Status
Presently there are six status of a coruotine

1. Queued = 0                   -> Coroutine is still queued waiting to be executed or is being executed
2. Completed = 1                -> Coroutine has Completed Successfully
3. Failed = 2                   -> Coroutine Completed Successfully , But callback function raised an exception
4. Cancelled = 3                -> Coroutine was Cancelled
5. Timeout = 4                  -> Coroutine did not complete in the given time
6. CoroutineException = 5       -> Coroutine Itself Raised an Exception

## Authors

* **Ankit Kathuria** - *Initial work*

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

* Hat tip to anyone whose code was used
* Inspiration
* etc
Flask-WXPay 1.0.5
Flask Extension for WeChat Pay.
License: MIT

微信支付Flask扩展
===================

文档
----

帮助文档: http://flask-wxpay.readthedocs.io/en/latest/


使用
----

initialized::

    from flask_wxpay import WXPay
    wxpay = WXPay()
    wxpay.init_app(app)

创建订单,生成prepay data::

    from flask_wxpay import now_str
    from core import wxpay

    out_trade_no = now_str()
    order_data = wxpay.unified_order(out_trade_no, total_fee, ip, body, openid=openid)
    prepay_data = wxpay.get_jsapi_prepay_data(order_data['prepay_id'])


配置项
------

==========================  =====================================================
WXPAY_BASE_URL              默认值: https://api.mch.weixin.qq.com
WXPAY_REQUEST_TIMEOUT       默认值: 10
WX_APPID                    公众账号ID
WXPAY_MCHID                 商户号
WXPAY_KEY                   商户支付密钥Key
WXPAY_NOTIFY_URL            默认异步通知url
WXPAY_ROOTCA_PATH           rootca证书路径，对应requests的verify参数,默认为None
WXPAY_APICLIENT_CERT_PATH   客户端证书路径，默认值None
WXPAY_APICLIENT_KEY_PATH    客户端证书key的路径，默认值None
WXPAY_SANDBOX               是否使用沙箱环境，默认为 False
==========================  =====================================================