semvec/pypi-packages huggingface dataset:
flask-cdc-devlibx 0.0.11
Python DSL for setting up Flask app CDC
License: MIT

This is a helper module to allow you to capture all the request/response which comes to your Flask app.

```shell
pip install flask-cdc-devlibx
```

### How to use

```python
from flask_cdc import cdc

# We expect you already have the flask app 
app = "Existing flask"


# Recorder is called everytime you get request response. You can do anything you want
# In this example we have logged data with a helper function provided by cdc. You can change
# this method to do anything else
def recorder(state):
    cdc.log_results(state)


# Wrap app to your session record MW    
app.wsgi_app = cdc.SessionRecorderMiddleware(app.wsgi_app, recorder)

```

### How to enable CDC

```shell
Set following env variable:
export CDC_KAFKA=<your kafka broker>
export CDC_TOPIC=<your kafka topic for CDC>
```

You can use the pre-defined recorder to send data to kafka:
```python
app.wsgi_app = cdc.SessionRecorderMiddleware(app.wsgi_app, cdc.publish_result_to_kafka)
```

Once it is defined then you can see the following data in your topic

```json
{
  "request": {
    "body": {
      "archive_existing_versions": true,
      "name": "harish",
      "stage": "Staging",
      "version": "2"
    },
    "method": "POST",
    "url": "/ajax-api/2.0/preview/mlflow/model-versions/transition-stage"
  },
  "response": {
    "status": "200 OK"
  }
}
```
datels 1.0.1
`datels` is a simple CLI that displays a list of dates line by line.
License: MIT
Requires Python: >=3.7,<3.10

# datels

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datels?style=plastic)](https://github.com/joe-yama/datels) [![PyPI - License](https://img.shields.io/pypi/l/datels?style=plastic)](https://github.com/joe-yama/datels) [![PyPI](https://img.shields.io/pypi/v/datels?style=plastic)](https://pypi.org/project/datels/) [![codecov](https://codecov.io/gh/joe-yama/datels/branch/main/graph/badge.svg?token=RCQSYF637E)](https://codecov.io/gh/joe-yama/datels)

`datels` is a simple CLI that displays a list of dates line by line.

## Installation

To install datels with pip, run: `pip install datels`

## Basic Usage

```bash
$ datels 1994-03-07 1994-03-10
1994/03/07
1994/03/08
1994/03/09
1994/03/10
```

### Date format option

```bash
$ datels 1994-03-07 1994-03-10 --sep="-"
1994-03-07
1994-03-08
1994-03-09
1994-03-10

$ datels 1994-03-07 1994-03-10 --format "%c"
Mon Mar  7 00:00:00 1994
Tue Mar  8 00:00:00 1994
Wed Mar  9 00:00:00 1994
Thu Mar 10 00:00:00 1994
```

See [strftime documentation](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior) for more information.

### Inclusive option

```bash
$ datels 1994-03-07 1994-03-10 --inclusive both
1994/03/07
1994/03/08
1994/03/09
1994/03/10

$ datels 1994-03-07 1994-03-10 --inclusive left
1994/03/07
1994/03/08
1994/03/09

$ datels 1994-03-07 1994-03-10 --inclusive right
1994/03/08
1994/03/09
1994/03/10
```

## Using in your python code not CLI

```bash
$ python
>>> from datels import list_dates
>>> dates = list_dates("1994-03-07", "1994-03-10", sep="-", inclusive="both")
>>> dates
['1994-03-07', '1994-03-08', '1994-03-09', '1994-03-10']
>>> # list_dates retuens list of string
>>> type(dates)
<class 'list'>
>>> type(dates[0])
<class 'str'>
```