header-propagation


Nameheader-propagation JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/joeraad/header-propagation
SummaryMiddleware propagating headers from incoming requests to outgoing requests in fastapi
upload_time2022-12-14 05:51:27
maintainerJoe Raad
docs_urlNone
authorJoe Raad
requires_python>=3.9,<4.0
licenseBSD-4-Clause
keywords asgi fastapi starlette async headers propagation middleware
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Header Propagation Middleware

Middleware for propagating headers from incoming requests to outgoing requests for FastAPI.

## Installation

```bash
pip install header-propagation-middleware
```

## Setup

To setup the middleware, you need to add it to your FastAPI app.

### Adding Middleware

```python
from header_propagation_middleware import HeaderPropagationMiddleware

app = FastAPI()
app.add_middleware(HeaderPropagationMiddleware,header_names=["header1","header2"])
```

#### Configurable middleware argument

**header_names**

-   Type: `List[str]`
-   Default: `[]`
-   Description: The list of headers to propagate.

### Accessing propagated headers

You can access the propagated headers using the `propagated_headers` object.

```python
from header_propagation_middleware import propagated_headers

propagated_headers.get()
```

**propagated_headers**

-   Type: `dict`
-   Default: `{}`
-   Description: The dictionary of propagated headers.

## Tests

Running test

```bash
python -m pytest
```

Running test with coverage report

```bash
python -m pytest --cov --cov-report=html:reports/html_dir
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/joeraad/header-propagation",
    "name": "header-propagation",
    "maintainer": "Joe Raad",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "joeraad12@gmail.com",
    "keywords": "asgi,fastapi,starlette,async,headers,propagation,middleware",
    "author": "Joe Raad",
    "author_email": "joeraad12@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/95/dd/37c25549106e3d9373f1e4d19c197bd3619173f6e33d25847791b6523caa/header_propagation-1.0.0.tar.gz",
    "platform": null,
    "description": "# Header Propagation Middleware\n\nMiddleware for propagating headers from incoming requests to outgoing requests for FastAPI.\n\n## Installation\n\n```bash\npip install header-propagation-middleware\n```\n\n## Setup\n\nTo setup the middleware, you need to add it to your FastAPI app.\n\n### Adding Middleware\n\n```python\nfrom header_propagation_middleware import HeaderPropagationMiddleware\n\napp = FastAPI()\napp.add_middleware(HeaderPropagationMiddleware,header_names=[\"header1\",\"header2\"])\n```\n\n#### Configurable middleware argument\n\n**header_names**\n\n-   Type: `List[str]`\n-   Default: `[]`\n-   Description: The list of headers to propagate.\n\n### Accessing propagated headers\n\nYou can access the propagated headers using the `propagated_headers` object.\n\n```python\nfrom header_propagation_middleware import propagated_headers\n\npropagated_headers.get()\n```\n\n**propagated_headers**\n\n-   Type: `dict`\n-   Default: `{}`\n-   Description: The dictionary of propagated headers.\n\n## Tests\n\nRunning test\n\n```bash\npython -m pytest\n```\n\nRunning test with coverage report\n\n```bash\npython -m pytest --cov --cov-report=html:reports/html_dir\n```\n\n",
    "bugtrack_url": null,
    "license": "BSD-4-Clause",
    "summary": "Middleware propagating headers from incoming requests to outgoing requests in fastapi",
    "version": "1.0.0",
    "split_keywords": [
        "asgi",
        "fastapi",
        "starlette",
        "async",
        "headers",
        "propagation",
        "middleware"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "43311e2b78bf3b62cae0c177799c9f10",
                "sha256": "dfa901061ec5aa822d6d78175b0c3e905fd9e615cafdc2f50b68df29f6789811"
            },
            "downloads": -1,
            "filename": "header_propagation-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "43311e2b78bf3b62cae0c177799c9f10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4126,
            "upload_time": "2022-12-14T05:51:25",
            "upload_time_iso_8601": "2022-12-14T05:51:25.679429Z",
            "url": "https://files.pythonhosted.org/packages/34/0f/910402e33454ae1ae4100c63dedc7efa77e3682988ab315d8848d26fcf1f/header_propagation-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "1d486c812db46f15d7cb0aeeab5ae335",
                "sha256": "2f6c7d150391660ca4c1c6cb871e9ec6b4adca6aaab77f22580d233aacede2b8"
            },
            "downloads": -1,
            "filename": "header_propagation-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1d486c812db46f15d7cb0aeeab5ae335",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 3964,
            "upload_time": "2022-12-14T05:51:27",
            "upload_time_iso_8601": "2022-12-14T05:51:27.430958Z",
            "url": "https://files.pythonhosted.org/packages/95/dd/37c25549106e3d9373f1e4d19c197bd3619173f6e33d25847791b6523caa/header_propagation-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-14 05:51:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "joeraad",
    "github_project": "header-propagation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "header-propagation"
}
        
Elapsed time: 0.01819s