meilisearch-fastapi


Namemeilisearch-fastapi JSON
Version 0.20.0 PyPI version JSON
download
home_pagehttps://github.com/sanders41/meilisearch-fastapi
SummaryMeilisearch integration with FastAPI
upload_time2024-08-04 00:55:35
maintainerNone
docs_urlNone
authorPaul Sanders
requires_python<4.0,>=3.9
licenseMIT
keywords meilisearch fastapi async search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Meilisearch FastAPI

![CI Status](https://github.com/sanders41/meilisearch-fastapi/workflows/CI/badge.svg?branch=main&event=push)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sanders41/meilisearch-fastapi/main.svg)](https://results.pre-commit.ci/latest/github/sanders41/meilisearch-fastapi/main)
[![Coverage](https://codecov.io/gh/sanders41/meilisearch-fastapi/branch/main/graphs/badge.svg?branch=main)](https://codecov.io/gh/sanders41/meilisearch-fastapi)
[![PyPI version](https://badge.fury.io/py/meilisearch-fastapi.svg)](https://badge.fury.io/py/meilisearch-fastapi)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/meilisearch-fastapi?color=5cc141)](https://github.com/sanders41/meilisearch-fastapi)

Meilisearch FastAPI provides [FastAPI](https://fastapi.tiangolo.com/) routes for interacting with [Meilisearch](https://www.meilisearch.com/).

## Installation

Using a virtual environmnet is recommended for installing this package. Once the virtual environment is created and activated install the package with:

```sh
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

```py
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

```py
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.

```txt
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](CONTRIBUTING.md)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sanders41/meilisearch-fastapi",
    "name": "meilisearch-fastapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "meilisearch, fastapi, async, search",
    "author": "Paul Sanders",
    "author_email": "psanders1@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2a/7b/eefb6ebf33bda900d0c5944f356b1b055a752f12f1630c287fe22d912428/meilisearch_fastapi-0.20.0.tar.gz",
    "platform": null,
    "description": "# Meilisearch FastAPI\n\n![CI Status](https://github.com/sanders41/meilisearch-fastapi/workflows/CI/badge.svg?branch=main&event=push)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sanders41/meilisearch-fastapi/main.svg)](https://results.pre-commit.ci/latest/github/sanders41/meilisearch-fastapi/main)\n[![Coverage](https://codecov.io/gh/sanders41/meilisearch-fastapi/branch/main/graphs/badge.svg?branch=main)](https://codecov.io/gh/sanders41/meilisearch-fastapi)\n[![PyPI version](https://badge.fury.io/py/meilisearch-fastapi.svg)](https://badge.fury.io/py/meilisearch-fastapi)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/meilisearch-fastapi?color=5cc141)](https://github.com/sanders41/meilisearch-fastapi)\n\nMeilisearch FastAPI provides [FastAPI](https://fastapi.tiangolo.com/) routes for interacting with [Meilisearch](https://www.meilisearch.com/).\n\n## Installation\n\nUsing a virtual environmnet is recommended for installing this package. Once the virtual environment is created and activated install the package with:\n\n```sh\npip install meilisearch-fastapi\n```\n\n## Useage\n\nRoutes 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.\n\n### Example with no authentication required for routes\n\n```py\nfrom fastapi import APIRouter, FastAPI\nfrom meilisearch_fastapi.routes import (\n    document_routes,\n    index_routes,\n    meilisearch_routes,\n    search_routes,\n    settings_routes,\n)\n\napp = FastAPI()\napi_router = APIRouter()\napi_router.include_router(document_routes.router, prefix=\"/documents\")\napi_router.include_router(index_routes.router, prefix=\"/indexes\")\napi_router.include_router(meilisearch_routes.router, prefix=\"/meilisearch\")\napi_router.include_router(search_routes.router, prefix=\"/search\")\napi_router.include_router(settings_routes.router, prefix=\"/settings\")\n\napp.include_router(api_router)\n```\n\n### Example with routes requiring authentication\n\n```py\nfrom fastapi import APIRouter, FastAPI\nfrom meilisearch_fastapi.routes import (\n    document_routes,\n    index_routes,\n    meilisearch_routes,\n    search_routes,\n    settings_routes,\n)\n\nfrom my_app import my_authentication\n\napp = FastAPI()\napi_router = APIRouter()\napi_router.include_router(document_routes.router, prefix=\"/documents\", dependeincies=[Depends(my_authentication)])\napi_router.include_router(index_routes.router, prefix=\"/indexes\", dependeincies=[Depends(my_authentication)])\napi_router.include_router(meilisearch_routes.router, prefix=\"/meilisearch\", dependeincies=[Depends(my_authentication)])\napi_router.include_router(search_routes.router, prefix=\"/search\", dependeincies=[Depends(my_authentication)])\napi_router.include_router(settings_routes.router, prefix=\"/settings\", dependeincies=[Depends(my_authentication)])\n\napp.include_router(api_router)\n```\n\nThe url for Meilisearch, weather an https address should be used, and API key are read from\nenvironment variables. Putting these into a .env file will keep you from having to set these\nvariables each time the terminal is restarted.\n\n```txt\nMEILI_HTTP_ADDR=localhost:7700  # This is the url for your instance of Meilisearch\nMEILI_HTTPS_URL=true  # Setting this specifies the address should be https://. If false or not included the address will be http://\nMEILI_MASTER_KEY=masterKey  # This is the API key for your Meilisearch instance\n```\n\nNow 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.\n\n## Contributing\n\nContributions to this project are welcome. If you are interested in contributing please see our [contributing guide](CONTRIBUTING.md)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Meilisearch integration with FastAPI",
    "version": "0.20.0",
    "project_urls": {
        "Documentation": "https://github.com/sanders41/meilisearch-fastapi",
        "Homepage": "https://github.com/sanders41/meilisearch-fastapi",
        "Repository": "https://github.com/sanders41/meilisearch-fastapi"
    },
    "split_keywords": [
        "meilisearch",
        " fastapi",
        " async",
        " search"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f7d7d4442927b5009b351b7a649baeac8eb52ef8292ec3fa69c3912ac5766721",
                "md5": "b4ac4c751041d83f1e3b3745d02dbbfd",
                "sha256": "b2c28a6e4c7baa2801f1646ca7f7a7f3020a7b395bc9587abe93af8695333b96"
            },
            "downloads": -1,
            "filename": "meilisearch_fastapi-0.20.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4ac4c751041d83f1e3b3745d02dbbfd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 12886,
            "upload_time": "2024-08-04T00:55:33",
            "upload_time_iso_8601": "2024-08-04T00:55:33.815828Z",
            "url": "https://files.pythonhosted.org/packages/f7/d7/d4442927b5009b351b7a649baeac8eb52ef8292ec3fa69c3912ac5766721/meilisearch_fastapi-0.20.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a7beefb6ebf33bda900d0c5944f356b1b055a752f12f1630c287fe22d912428",
                "md5": "f9987c21a18982a03b0812a751675ec6",
                "sha256": "4e730496ac2df690fc4ab30a56ae8820b815ebf66364697a20c479cc6b599cf8"
            },
            "downloads": -1,
            "filename": "meilisearch_fastapi-0.20.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f9987c21a18982a03b0812a751675ec6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 9786,
            "upload_time": "2024-08-04T00:55:35",
            "upload_time_iso_8601": "2024-08-04T00:55:35.513213Z",
            "url": "https://files.pythonhosted.org/packages/2a/7b/eefb6ebf33bda900d0c5944f356b1b055a752f12f1630c287fe22d912428/meilisearch_fastapi-0.20.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-04 00:55:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sanders41",
    "github_project": "meilisearch-fastapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "meilisearch-fastapi"
}
        
Elapsed time: 1.72654s