meilisearch-fastapi


Namemeilisearch-fastapi JSON
Version 0.19.0 PyPI version JSON
download
home_pagehttps://github.com/sanders41/meilisearch-fastapi
SummaryMeilisearch integration with FastAPI
upload_time2023-11-06 00:14:51
maintainer
docs_urlNone
authorPaul Sanders
requires_python>=3.8,<4.0
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": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "meilisearch,fastapi,async,search",
    "author": "Paul Sanders",
    "author_email": "psanders1@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/58/20eadef178b71d22f3edd851130b820a3ad8368207582c22a37cee1c981f/meilisearch_fastapi-0.19.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.19.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": "870a28b84d2ba4d27bdb9c7076f0825d95ded59b314f5d433da4367448c725d9",
                "md5": "a8f60e6d6b80202264023a0af4fe9966",
                "sha256": "edaccd06fb1474b3a3a6c94a1794875bb59fa4a09d539867cd67c76c7af06fd8"
            },
            "downloads": -1,
            "filename": "meilisearch_fastapi-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a8f60e6d6b80202264023a0af4fe9966",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 12811,
            "upload_time": "2023-11-06T00:14:46",
            "upload_time_iso_8601": "2023-11-06T00:14:46.823990Z",
            "url": "https://files.pythonhosted.org/packages/87/0a/28b84d2ba4d27bdb9c7076f0825d95ded59b314f5d433da4367448c725d9/meilisearch_fastapi-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e45820eadef178b71d22f3edd851130b820a3ad8368207582c22a37cee1c981f",
                "md5": "aa668f0419401f3bbd3797d9d02b8c15",
                "sha256": "260fb16e866b10f1d3c98d387284eb1f627a186d228d1a4d975172828ae68565"
            },
            "downloads": -1,
            "filename": "meilisearch_fastapi-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "aa668f0419401f3bbd3797d9d02b8c15",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 9645,
            "upload_time": "2023-11-06T00:14:51",
            "upload_time_iso_8601": "2023-11-06T00:14:51.711566Z",
            "url": "https://files.pythonhosted.org/packages/e4/58/20eadef178b71d22f3edd851130b820a3ad8368207582c22a37cee1c981f/meilisearch_fastapi-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-06 00:14:51",
    "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: 0.16316s