semvec/pypi-packages huggingface dataset:
blacksheep-context 0.1.0
Middleware for blacksheep that allows you to store and access the context data of a request.
License: MIT
Requires Python: >=3.7,<4.0
Keywords: blacksheep,context,middleware,blacksheep-context

# Blacksheep Context

[![Build Status](https://github.com/Cdayz/blacksheep-context/workflows/Continuous%20Integration/badge.svg)](https://github.com/Cdayz/blacksheep-context/actions)
[![codecov](https://codecov.io/gh/Cdayz/blacksheep-context/branch/master/graph/badge.svg?token=5KFIGS17S4)](https://codecov.io/gh/Cdayz/blacksheep-context)
[![Package Version](https://img.shields.io/pypi/v/blacksheep-context?logo=PyPI&logoColor=white)](https://pypi.org/project/blacksheep-context/)
[![PyPI Version](https://img.shields.io/pypi/pyversions/blacksheep-context?logo=Python&logoColor=white)](https://pypi.org/project/blacksheep-context/)

## Introduction

Middleware for Blacksheep that allows you to store and access the context data of a request.
Can be used with logging so logs automatically use request headers such as x-request-id or x-correlation-id.

## Requirements

* Python 3.7+
* Blacksheep 1.0.7+

## Installation

```console
$ pip install blacksheep-context
```

## Usage

A complete example shown below.

```python
from blacksheep.server import Application
from blacksheep.messages import Request, Response
from blacksheep.server.responses import json

from blacksheep_context import context
from blacksheep_context.middleware import ContextMiddleware
from blacksheep_context.plugins import BasePlugin, HeaderPlugin


class RequestIdPlugin(HeaderPlugin):
    header_key = b'X-Request-Id'
    # Every plugin must provide this attribute
    context_key = 'request-id'
    # Fetches only first value of header, can be False to insert all values of header into context
    single_value_header = True

    # Also allow you to add some data from context into response
    async def enrich_response(self, response: Response) -> None:
        response.add_header(b'X-Request-Id', context['request_id'].encode('utf-8'))


class MyCustomPlugin(BasePlugin):
    context_key = 'user-data'

    # You can customize fetching data from request
    async def process_request(self, request: Request):
        try:
            data = await request.json()
            return data.get('user-id')
        except Exception:
            return None


ctx_middleware = ContextMiddleware(plugins=[RequestIdPlugin(), MyCustomPlugin()])

app_ = Application()
app_.middlewares.append(ctx_middleware)

@app_.router.post('/ctx')
def return_context(request):
    assert context.exists() is True
    return json(context.copy())
```

## Contributing

This project is absolutely open to contributions so if you have a nice idea, create an issue to let the community 
discuss it.
snit 0.1.1
Python command line application to backup IDE / code editor settings. 
License: MIT
Requires Python: >=3.9,<4.0

# snit

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Python command line application to backup IDE / code editor settings. 
**Currently only VSCode is supported**.

Motivation: I have most of my projects in Github, but don't want to put editor settings there.  This lets me save the important information in *launch.json*, *settings.json*, to some central location. 


## Project Features

* Simply copies files to given destination 
* files are numgered sequentially, like old-school [VMS](https://en.wikipedia.org/wiki/Versioning_file_system#Files-11_(RSX-11_and_OpenVMS))
* files are compared so only changed files are backed up.
* numbering preserves the extension so the OS still recognizes the file type.


## Alternatives

VSCode offers settings sync, but not for workspaces, only for user settings.

Git, Hg, etc. seem too heavy.

## Installation

    $ pip install snit

## Usage
    $ snit [OPTIONS] COMMAND

    Options:
       -a, --archive PATH    Specify the directory for the archive.  Can be set with
                             the SNIT_DIR environment variable.  [required]
       --help                Show this message and exit.

    Commands:
        backup  Backup editor settings.  
        list    List any found backups.  

## Example:
(Windows, with `SNIT_DIR` set)

    D:\Code\MyBigProject>snit backup

Copies workspace settings to `$SNIT_DIR\D__Code_MyBigProject\vscode`

## ToDo
Verify Unix compatibility.
python-lnd-grpc 0.0.8.5
grpc client for lnd python version 3.6+
License: MIT
Requires Python: >=3.6
Keywords: python grpc lnd lightning bitcoin async lightning-network rpc

## Install python package locally from pypi:

    import python_lnd_grpc

 
## Initiate the connector class

    lightning = python_lnd_grpc.LNDMethods()
    walletunlocker = python_lnd_grpc.WalletUnlocker()

## Use methods

    info = lightning.getinfo()
    print(info)

## Method naming
All methods mentioned in https://api.lightning.community/#lnd-grpc-api-reference are fully lowercase in python_lnd_grpc library. For example `AbandonChannel` request relates to method `abandonchannel()`

## Custom connector object

User can modify connector object in cases when connection to remote lnd node is needed (instead of local one), specifying custom parameters, like paths and file names:

    lightning = python_lnd_grpc.LNDMethods(
        tls_file_path = "~/.lnd/",
        tls_file_name = "remote.cert", 
        custom_tls_path_full = "~/.lnd/fullpath.cert",
        macaroon_filename = "remote.macaroon",
        macaroon_path = "~/.lnd/data/chain/bitcoin/",
        custom_macaroon_path_full = "~/.lnd/data/chain/bitcoin/mainnet/full_path.macaroon",
        grpc_host = "192.168.0.199",
        grpc_port = "10009",
        network = "mainnet",
        output = "json-none-included",
        macaroon_bytes = "bytes",
        tls_file_bytes = "bytes")

Different types of output will result in either:
 - grpc class output `output = None`
 - json string without NOT initialized arguments `output = json`
 - dictionary without NOT initialized arguments `output = dictionary`
 - json string with NOT initialized arguments `output = json-none-included`
 - dictionary with NOT initialized arguments `output = dictionary-none-included`

In case of connecting to remote lnd node, the grpc setting in `lnd.conf` has to be set to listening:

    rpclisten=0.0.0.0:10009