semvec/pypi-packages huggingface dataset:
Flask-SignalBus 0.5.20
A Flask-SQLAlchemy extension for atomically sending messages (signals) over a message bus
License: MIT

Flask-SignalBus
---------------

Adds to Flask-SQLAlchemy the capability to *atomically* send messages
(signals) over a message bus.

The processing of each message involves three steps:

  1. The message is recorded in the SQL database as a row in a table.

  2. The message is sent over the message bus (RabbitMQ for example).

  3. Message's corresponding table row is deleted.

Normally, the sending of the recorded messages (steps 2 and 3) is done
automatically after each transaction commit, but when needed, it can
also be triggered explicitly with a method call, or through the Flask
CLI.
logger-generate 0.2.0
開箱即用的logger。 easy to generate logger.
License: MIT
Requires Python: >=3.8,<4.0
Keywords: logger,logging,generate

# logger_generate

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/26699f09d35542bcb96c9d0164e27a1e)](https://www.codacy.com/gh/we684123/logger_generate/dashboard?utm_source=github.com&utm_medium=referral&utm_content=we684123/logger_generate&utm_campaign=Badge_Grade)

生成 logger 用的，清涼舒爽  
開箱即用的 logger。

A python package  
easy to generate logger.

## Install

pip

```bash
pip install -U logger-generate
```

poetry

```bash
poetry add logger-generate
```

## Example

```python
from config import base
from logger_generate import generate

logger = generate()
logger.info("引入即用 ( •̀ ω •́ )✧")

logger_config = {
    "logging_level": 'DEBUG',
    "log_file_path": './logs/by_logger_config.log',
    "log_format": '%(asctime)s - %(levelname)s : %(message)s',
    "backupCount": 7,
    "when": 'D',
    "encoding": 'utf-8',
}
logger = generate(logger_config, name='from_dict')
logger.info("亦可用程式內 dict 設定")

logger = generate(base.logger_config(), "from_config_file")
logger.info("也以用從檔案引入 config")

logger = generate(logger_config, name='方便生成隨機log名稱', need_serial=True)
logger.info("←後方隨機5字元")

logger = generate(base.logger_config(), "ex", True)
logger.info("示範單純用位置作為輸入手段")

logger = generate(logging_level='DEBUG',
                  name='use_kwargs',
                  log_file_path='./logs/use_kwargs.log')
logger.info("現在也可以用 kwargs 設定 logger")
```

![2022-10-29 22_38_04-logger_generate @ z170_hero](https://user-images.githubusercontent.com/22027801/198837773-27f1a516-c99a-4518-86e9-42ff9c4faab0.png)
starlette-session 0.4.3
A library for backend side session with starlette
License: MIT
Requires Python: >=3.7,<4

<p align="center">

<a href="https://github.com/auredentan/starlette-session/actions?query=workflow%3ATest" target="_blank">
  <img src="https://github.com/auredentan/starlette-session/workflows/Test/badge.svg?branch=master" alt="Test"/>
</a>

<a href="https://pypi.org/project/starlette-session" target="_blank">
  <img src="https://img.shields.io/pypi/v/starlette-session?color=%2334D058&label=pypi%20package" alt="Package version"/>
</a>

<a href="https://codecov.io/gh/auredentan/starlette-session" target="_blank">
  <img src="https://codecov.io/gh/auredentan/starlette-session/branch/master/graph/badge.svg" alt="Code coverage"/>
</a>

</p>

---

**Documentation:** [https://auredentan.github.io/starlette-session/](https://auredentan.github.io/starlette-session/)

---

# Starlette Session

Starlette session is a simple session middleware for [starlette](https://github.com/encode/starlette/) that enable server side session with starlette.

## Requirements

Python 3.6+

## Installation

```bash
pip install starlette-session
```

## Example

Using redis as backend

```python
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.routing import Route

from starlette_session import SessionMiddleware
from starlette_session.backends import BackendType

from redis import Redis

async def setup_session(request: Request) -> JSONResponse:
    request.session.update({"data": "session_data"})
    return JSONResponse({"session": request.session})


async def clear_session(request: Request):
    request.session.clear()
    return JSONResponse({"session": request.session})


def view_session(request: Request) -> JSONResponse:
    return JSONResponse({"session": request.session})


routes = [
    Route("/setup_session", endpoint=setup_session),
    Route("/clear_session", endpoint=clear_session),
    Route("/view_session", endpoint=view_session),
]

redis_client = Redis(host="localhost", port=6379)
app = Starlette(debug=True, routes=routes)
app.add_middleware(
    SessionMiddleware,
    secret_key="secret",
    cookie_name="cookie22",
    backend_type=BackendType.redis,
    backend_client=redis_client,
)

```

You can find more example [here](https://github.com/auredentan/starlette-session/tree/master/examples)

## Using a custom backend

You can provide a custom backend to be used. This backend has simply to implement the interface ISessionBackend

```python
class ISessionBackend(ABC):
    @abstractmethod
    async def get(self, key: str) -> Optional[dict]:
        raise NotImplementedError()

    @abstractmethod
    async def set(self, key: str, value: dict, exp_in_mins: str) -> Optional[str]:
        raise NotImplementedError()

    @abstractmethod
    async def delete(key: str) -> Any:
        raise NotImplementedError()
```