Meilisearch FastAPI
Meilisearch FastAPI provides FastAPI routes for interacting with Meilisearch.
⚠️This project has been archived and is no longer supported. If you are using Meilisearch with FastAPI you can use meilisearch-python-sdk it integrate Meilisearch.
Installation
Using a virtual environmnet is recommended for installing this package. Once the virtual environment is created and activated install the package with:
pip install meilisearch-fastapi
Useage
Routes are split in groups so that different dependencies can be injected, and therefore different levels of access, can be given to different groups of routes.
Example with no authentication required for routes
from fastapi import APIRouter, FastAPI
from meilisearch_fastapi.routes import (
document_routes,
index_routes,
meilisearch_routes,
search_routes,
settings_routes,
)
app = FastAPI()
api_router = APIRouter()
api_router.include_router(document_routes.router, prefix="/documents")
api_router.include_router(index_routes.router, prefix="/indexes")
api_router.include_router(meilisearch_routes.router, prefix="/meilisearch")
api_router.include_router(search_routes.router, prefix="/search")
api_router.include_router(settings_routes.router, prefix="/settings")
app.include_router(api_router)
Example with routes requiring authentication
from fastapi import APIRouter, FastAPI
from meilisearch_fastapi.routes import (
document_routes,
index_routes,
meilisearch_routes,
search_routes,
settings_routes,
)
from my_app import my_authentication
app = FastAPI()
api_router = APIRouter()
api_router.include_router(document_routes.router, prefix="/documents", dependeincies=[Depends(my_authentication)])
api_router.include_router(index_routes.router, prefix="/indexes", dependeincies=[Depends(my_authentication)])
api_router.include_router(meilisearch_routes.router, prefix="/meilisearch", dependeincies=[Depends(my_authentication)])
api_router.include_router(search_routes.router, prefix="/search", dependeincies=[Depends(my_authentication)])
api_router.include_router(settings_routes.router, prefix="/settings", dependeincies=[Depends(my_authentication)])
app.include_router(api_router)
The url for Meilisearch, weather an https address should be used, and API key are read from environment variables. Putting these into a .env file will keep you from having to set these variables each time the terminal is restarted.
MEILI_HTTP_ADDR=localhost:7700 # This is the url for your instance of Meilisearch
MEILI_HTTPS_URL=true # Setting this specifies the address should be https://. If false or not included the address will be http://
MEILI_MASTER_KEY=masterKey # This is the API key for your Meilisearch instance
Now the Meilisearch routes will be available in your FastAPI app. Documentation for the routes can be viewed in the OpenAPI documentation of the FastAPI app. To view this start your FastAPI app and naviate to the docs http://localhost:8000/docs replacing the url with the correct url for your app.
Contributing
Contributions to this project are welcome. If you are interested in contributing please see our contributing guide
Metadata
Release files for meilisearch-fastapi 0.21.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| meilisearch_fastapi-0.21.1.tar.gz | 9.7 kB | Without provenance | Details for meilisearch_fastapi-0.21.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meilisearch_fastapi-0.21.1-py3-none-any.whl | Python 3 | none | any | Details for meilisearch_fastapi-0.21.1-py3-none-any.whl |
Total release size: 22.8 kB
Release files / meilisearch_fastapi-0.21.1.tar.gz
| Download URL | meilisearch_fastapi-0.21.1.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
015f916f33958295b65067dbc69a2d1aa8b19f67aa1494d1f314f3ba19f343b0
|
|
BLAKE2b-256 checksum How to use checksums |
c5b1c618cd2089214efbd87329f2b2fa30340fa23a0dfba5bedbdb2e58d7d6ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure
|
Release files / meilisearch_fastapi-0.21.1-py3-none-any.whl
| Download URL | meilisearch_fastapi-0.21.1-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6efed70473ddefea4a4fcdf033556b607ac356fde7ec774fb2b89c6a29c97ee0
|
|
BLAKE2b-256 checksum How to use checksums |
aa43a46497636565f85624044d70e8e1aed3879fb9ff77490982c668f0759165
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure
|
Security for meilisearch-fastapi 0.21.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.