semvec/pypi-packages huggingface dataset:
pycerpt 0.2.1
A cli utility for generating excerpts from highlighted PDFs

# pycerpt [![PyPI version](https://badge.fury.io/py/pycerpt.svg)](https://badge.fury.io/py/pycerpt) [![Build Status](https://travis-ci.org/MerlinB/pycerpt.svg?branch=master)](https://travis-ci.org/MerlinB/pycerpt) ![](https://img.shields.io/pypi/pyversions/pycerpt.svg)


pycerpt is a  command line utility for extracting highlighted text from PDFs.


## Quickstart
Get the latest version with `pip install pycerpt`.

pycerpt outputs to markdown as default. Use with `excerpt test.pdf` or save to a file with `excerpt test.pdf > out.md` or `excerpt test.pdf out.md`.

### Generating PDFs
For PDF generation additional dependencies are needed: `pip install pycerpt[pdf]`.  
Usage: `excerpt test.pdf out.pdf`.
pymc3-models 2.1.0
Custom PyMC3 models built on top of the scikit-learn API

# PyMC3 Models

Custom PyMC3 models built on top of the scikit-learn API. Check out the [docs](http://pymc3-models.readthedocs.io/).

## Features

- Reusable PyMC3 models including LinearRegression and HierarchicalLogisticRegression
- A base class, BayesianModel, for building your own PyMC3 models

## Installation
The latest release of PyMC3 Models can be installed from PyPI using `pip`:

``` bash
pip install pymc3_models
```

The current development branch of PyMC3 Models can be installed from GitHub, also using `pip`:

``` bash
pip install git+https://github.com/parsing-science/pymc3_models.git
```

To run the package locally (in a virtual environment):

```
git clone https://github.com/parsing-science/pymc3_models.git
cd pymc3_models
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
```

## Usage
Since PyMC3 Models is built on top of scikit-learn, you can use the same methods as with a scikit-learn model.

``` python
from pymc3_models import LinearRegression

LR = LinearRegression()
LR.fit(X, Y)
LR.predict(X)
LR.score(X, Y)
```

## Contribute
For more info, see [CONTRIBUTING](https://github.com/parsing-science/pymc3_models/blob/master/CONTRIBUTING.rst).

### Contributor Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](http://contributor-covenant.org/). By participating in this project you agree to abide by its terms. See [CODE_OF_CONDUCT](https://github.com/parsing-science/pymc3_models/blob/master/CODE_OF_CONDUCT.rst).

## Acknowledgments
This library is built on top of [PyMC3](http://docs.pymc.io/) and [scikit-learn](http://scikit-learn.org).

## License
[Apache License, Version 2.0](https://github.com/parsing-science/pymc3_models/blob/master/LICENSE)
drel 0.5.1
Django request ElasticSearch logging

# drel

Django request ElasticSearch logging

## Django support

To log every django request insert LoggingMiddleware before AuthenticationMiddleware:

```python
# settings.py

MIDDLEWARE = [
    ...,
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "drel.django.LoggingMiddleware",
    ...
]
```

This will insert request and response info to Elastic Search index called `logs-{week_start}-{week_end}` in following format: 

```json
{
    "timestamp": "2018-12-09 02:22:22",
    "type": "default",
    "request": {
      "url": "https://httpbin.org/post",
      "data": {"param1": "value1"},
      "headers": {}
    },
    "response": {
      "status": 200,
      "data": {"args": {}, "data": "", "files": {}, "form": {"param1": "value1"}, "headers": {"Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Content-Length": "13", "Content-Type": "application/x-www-form-urlencoded", "Host": "httpbin.org", "User-Agent": "python-requests/2.19.1"}, "json": null, "origin": "130.193.67.76", "url": "https://httpbin.org/post"}
    },
    "app": "default",
    "request_id": "2180930f-859b-4aef-8770-17107fff1170"
}
```

## Requests support

To log [requests](http://docs.python-requests.org/en/master/) request and response data use `drel.requests.log` function: 

```pydocstring
>>> from drel.requests import post, log
>>> request, response = post("https://httpbin.org/post", {"param1": "value1"})
>>> log(request, response)
```

## Configuration

To change settings override `config` module values:

```python
from drel import config

config.APPLICATION = "django_app"
``` 


### Sample Django configuration

```python
from django.http import HttpRequest
from drel.core import config
from drel.django import mail_admins_on_es_exception

def ignore_logging_handler(request: HttpRequest) -> bool:
    return any([
        request.path == "/api/register_device/",
        request.method != "POST",
    ])


config.ELASTIC_SEARCH_EXCEPTION_HANDLER = mail_admins_on_es_exception
config.INDEX_NAME_GETTER = lambda: "django_app_2019-01-01"
config.APPLICATION = "django_app"
config.IGNORE_LOGGING_HANDLER = ignore_logging_handler
```

This configuration:

 - mail admins on Elastic Search index exception
 - ignore logging non-POST and /api/register_device/ requests
 - insert docs to django_app_2019-01-01 index
 - application field = django_app