%global _empty_manifest_terminate_build 0 Name: python-fastapi-health Version: 0.4.0 Release: 1 Summary: Heath check on FastAPI applications. License: MIT URL: https://github.com/Kludex/fastapi-health Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ce/97/27bdba7462672adf9815c0ac05c6d1c1ff49527b5d5a8a4e41034a58b6c2/fastapi-health-0.4.0.tar.gz BuildArch: noarch Requires: python3-fastapi %description

FastAPI Health 🚑️

Latest Commit
Package version

The goal of this package is to help you to implement the [Health Check API](https://microservices.io/patterns/observability/health-check-api.html) pattern. ## Installation ``` bash pip install fastapi-health ``` ## Quick Start Create the health check endpoint dynamically using different conditions. Each condition is a callable, and you can even have dependencies inside of it: ```python from fastapi import FastAPI, Depends from fastapi_health import health def get_session(): return True def is_database_online(session: bool = Depends(get_session)): return session app = FastAPI() app.add_api_route("/health", health([is_database_online])) ``` ## Advanced Usage The `health()` method receives the following parameters: - `conditions`: A list of callables that represents the conditions of your API, it can return either `bool` or a `dict`. - `success_output`: An optional dictionary that will be the content response of a successful health call. - `failure_output`: An optional dictionary analogous to `success_output` for failure scenarios. - `success_status`: An integer that overwrites the default status (200) in case of success. - `failure_status`: An integer that overwrites the default status (503) in case of failure. It's important to notice that you can have a _peculiar_ behavior in case of hybrid return statements (`bool` and `dict`) on the conditions. For example: ``` Python from fastapi import FastAPI from fastapi_health import health def healthy_condition(): return {"database": "online"} def sick_condition(): return False app = FastAPI() app.add_api_route("/health", health([healthy_condition, sick_condition])) ``` This will generate a response composed by the status being 503 (default `failure_status`), because `sick_condition` returns `False`, and the JSON body `{"database": "online"}`. It's not wrong, or a bug. It's meant to be like this. ## License This project is licensed under the terms of the MIT license. %package -n python3-fastapi-health Summary: Heath check on FastAPI applications. Provides: python-fastapi-health BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-fastapi-health

FastAPI Health 🚑️

Latest Commit
Package version

The goal of this package is to help you to implement the [Health Check API](https://microservices.io/patterns/observability/health-check-api.html) pattern. ## Installation ``` bash pip install fastapi-health ``` ## Quick Start Create the health check endpoint dynamically using different conditions. Each condition is a callable, and you can even have dependencies inside of it: ```python from fastapi import FastAPI, Depends from fastapi_health import health def get_session(): return True def is_database_online(session: bool = Depends(get_session)): return session app = FastAPI() app.add_api_route("/health", health([is_database_online])) ``` ## Advanced Usage The `health()` method receives the following parameters: - `conditions`: A list of callables that represents the conditions of your API, it can return either `bool` or a `dict`. - `success_output`: An optional dictionary that will be the content response of a successful health call. - `failure_output`: An optional dictionary analogous to `success_output` for failure scenarios. - `success_status`: An integer that overwrites the default status (200) in case of success. - `failure_status`: An integer that overwrites the default status (503) in case of failure. It's important to notice that you can have a _peculiar_ behavior in case of hybrid return statements (`bool` and `dict`) on the conditions. For example: ``` Python from fastapi import FastAPI from fastapi_health import health def healthy_condition(): return {"database": "online"} def sick_condition(): return False app = FastAPI() app.add_api_route("/health", health([healthy_condition, sick_condition])) ``` This will generate a response composed by the status being 503 (default `failure_status`), because `sick_condition` returns `False`, and the JSON body `{"database": "online"}`. It's not wrong, or a bug. It's meant to be like this. ## License This project is licensed under the terms of the MIT license. %package help Summary: Development documents and examples for fastapi-health Provides: python3-fastapi-health-doc %description help

FastAPI Health 🚑️

Latest Commit
Package version

The goal of this package is to help you to implement the [Health Check API](https://microservices.io/patterns/observability/health-check-api.html) pattern. ## Installation ``` bash pip install fastapi-health ``` ## Quick Start Create the health check endpoint dynamically using different conditions. Each condition is a callable, and you can even have dependencies inside of it: ```python from fastapi import FastAPI, Depends from fastapi_health import health def get_session(): return True def is_database_online(session: bool = Depends(get_session)): return session app = FastAPI() app.add_api_route("/health", health([is_database_online])) ``` ## Advanced Usage The `health()` method receives the following parameters: - `conditions`: A list of callables that represents the conditions of your API, it can return either `bool` or a `dict`. - `success_output`: An optional dictionary that will be the content response of a successful health call. - `failure_output`: An optional dictionary analogous to `success_output` for failure scenarios. - `success_status`: An integer that overwrites the default status (200) in case of success. - `failure_status`: An integer that overwrites the default status (503) in case of failure. It's important to notice that you can have a _peculiar_ behavior in case of hybrid return statements (`bool` and `dict`) on the conditions. For example: ``` Python from fastapi import FastAPI from fastapi_health import health def healthy_condition(): return {"database": "online"} def sick_condition(): return False app = FastAPI() app.add_api_route("/health", health([healthy_condition, sick_condition])) ``` This will generate a response composed by the status being 503 (default `failure_status`), because `sick_condition` returns `False`, and the JSON body `{"database": "online"}`. It's not wrong, or a bug. It's meant to be like this. ## License This project is licensed under the terms of the MIT license. %prep %autosetup -n fastapi-health-0.4.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-fastapi-health -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed Apr 12 2023 Python_Bot - 0.4.0-1 - Package Spec generated