fastapi-commons 0.4.1__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastapi_commons-0.4.1/src/fastapi_commons.egg-info → fastapi_commons-0.4.2}/PKG-INFO +1 -1
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/__init__.py +1 -1
- fastapi_commons-0.4.2/src/fastapi_commons/helpers.py +10 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/log_context.py +1 -1
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2/src/fastapi_commons.egg-info}/PKG-INFO +1 -1
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons.egg-info/SOURCES.txt +1 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.coveragerc +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.env_template +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.github/workflows/checks.yml +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.github/workflows/python-publish.yaml +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.github/workflows/release-on-tag-push.yml +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.gitignore +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.pre-commit-config.yaml +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/.python-version +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/AUTHORS.rst +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/CHANGELOG.rst +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/LICENSE +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/README.md +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/README.rst +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/pyproject.toml +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/setup.cfg +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/auth.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/conf.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/handlers.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/instrumentation.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/__init__.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/correlation_id.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/prometheus.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons.egg-info/dependency_links.txt +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons.egg-info/requires.txt +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons.egg-info/top_level.txt +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/tests/__init__.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/tests/conftest.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/tests/unit/__init__.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/tests/unit/test_poc.py +0 -0
- {fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/uv.lock +0 -0
|
@@ -2,7 +2,7 @@ import importlib.metadata
|
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
4
|
from fastapi_commons.instrumentation import setup_opentelemetry
|
|
5
|
-
from fastapi_commons.middleware import PrometheusMiddleware, metrics
|
|
5
|
+
from fastapi_commons.middleware.prometheus import PrometheusMiddleware, metrics
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
dist_name = __name__
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from typing import Annotated
|
|
2
|
+
|
|
3
|
+
from fastapi import Header, Request
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_client_ip(request: Request, x_forwarded_for: Annotated[str | None, Header()] = None) -> str | None:
|
|
7
|
+
if x_forwarded_for:
|
|
8
|
+
return x_forwarded_for
|
|
9
|
+
|
|
10
|
+
return client.host if (client := request.client) else None
|
{fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/log_context.py
RENAMED
|
@@ -3,7 +3,7 @@ import contextvars
|
|
|
3
3
|
from fastapi import Request, Response
|
|
4
4
|
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from fastapi_commons.helpers import get_client_ip
|
|
7
7
|
|
|
8
8
|
log_context: contextvars.ContextVar[dict | None] = contextvars.ContextVar('log_context', default=None)
|
|
9
9
|
|
|
@@ -17,6 +17,7 @@ src/fastapi_commons/__init__.py
|
|
|
17
17
|
src/fastapi_commons/auth.py
|
|
18
18
|
src/fastapi_commons/conf.py
|
|
19
19
|
src/fastapi_commons/handlers.py
|
|
20
|
+
src/fastapi_commons/helpers.py
|
|
20
21
|
src/fastapi_commons/instrumentation.py
|
|
21
22
|
src/fastapi_commons.egg-info/PKG-INFO
|
|
22
23
|
src/fastapi_commons.egg-info/SOURCES.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/correlation_id.py
RENAMED
|
File without changes
|
{fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons/middleware/prometheus.py
RENAMED
|
File without changes
|
{fastapi_commons-0.4.1 → fastapi_commons-0.4.2}/src/fastapi_commons.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|