fastapi-client


Namefastapi-client JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/LamaAni/fastapi_client
SummaryA client for the fastapi environment
upload_time2024-06-20 04:58:01
maintainerNone
docs_urlNone
authorZav Shotan
requires_pythonNone
licenseNone
keywords fastapi client fastapi_client
VCS
bugtrack_url
requirements fastapi requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FastAPIClient

An easy to use, integrated client for FastApi,

1. Uses the same decorators as FastApi
2. Dose not require one to "recreate" clients and works out of the box.
3. Allows defining the client "host" via the `with` command.
4. Works with async as well.

## BETA

This repo is in beta mode, some bugs may still exist and test coverage is not complete.
PR's welcome.

# TL;DR

To use the client you must call define the api,

```python

from typing import Annotated
from fastapi import FastAPI, Cookie, Body
from fastapi_client import FastAPIClient

api = FastAPI()

# This is required in order to allow the fast api
# client to wrap around any function calls.
# NOTE: It DOSE NOT AFFECT the operation of the API, and it dose not slow it down
# in any way.
FastAPIClient.enable(api)

@api.get("/echo")
def echo(a: int, b: int):
    rslt = a + b
    print(rslt)
    return rslt

```

We then can (async methods, just add async),

```python
from test_module import echo
from fastapi_client import FastAPIClient

# Call the function locally
echo(1,2)

# Call the function on the server running in localhost
with FastAPIClient("localhost:8080"):
    print(echo(1, 2))
```

## Install

```shell
pip install fastapi_client
```

# Contribution

Feel free to ping me in issues or directly on LinkedIn to contribute.

# Future implementation

We plan to support multiple python version per environment.

Looking for help on this subject.

# License

Copyright ©
`Zav Shotan` and other [contributors](graphs/contributors).
It is free software, released under the MIT licence, and may be redistributed under the terms specified in [LICENSE](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LamaAni/fastapi_client",
    "name": "fastapi-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "fastapi, client, fastapi_client",
    "author": "Zav Shotan",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ac/c3/479bd61dc4b48a1b81d4a484eab7ada012913ba2e253f75450e42d485beb/fastapi_client-0.0.1.tar.gz",
    "platform": null,
    "description": "# FastAPIClient\n\nAn easy to use, integrated client for FastApi,\n\n1. Uses the same decorators as FastApi\n2. Dose not require one to \"recreate\" clients and works out of the box.\n3. Allows defining the client \"host\" via the `with` command.\n4. Works with async as well.\n\n## BETA\n\nThis repo is in beta mode, some bugs may still exist and test coverage is not complete.\nPR's welcome.\n\n# TL;DR\n\nTo use the client you must call define the api,\n\n```python\n\nfrom typing import Annotated\nfrom fastapi import FastAPI, Cookie, Body\nfrom fastapi_client import FastAPIClient\n\napi = FastAPI()\n\n# This is required in order to allow the fast api\n# client to wrap around any function calls.\n# NOTE: It DOSE NOT AFFECT the operation of the API, and it dose not slow it down\n# in any way.\nFastAPIClient.enable(api)\n\n@api.get(\"/echo\")\ndef echo(a: int, b: int):\n    rslt = a + b\n    print(rslt)\n    return rslt\n\n```\n\nWe then can (async methods, just add async),\n\n```python\nfrom test_module import echo\nfrom fastapi_client import FastAPIClient\n\n# Call the function locally\necho(1,2)\n\n# Call the function on the server running in localhost\nwith FastAPIClient(\"localhost:8080\"):\n    print(echo(1, 2))\n```\n\n## Install\n\n```shell\npip install fastapi_client\n```\n\n# Contribution\n\nFeel free to ping me in issues or directly on LinkedIn to contribute.\n\n# Future implementation\n\nWe plan to support multiple python version per environment.\n\nLooking for help on this subject.\n\n# License\n\nCopyright \u00a9\n`Zav Shotan` and other [contributors](graphs/contributors).\nIt is free software, released under the MIT licence, and may be redistributed under the terms specified in [LICENSE](LICENSE).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A client for the fastapi environment",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/LamaAni/fastapi_client",
        "Source": "https://github.com/LamaAni/fastapi_client"
    },
    "split_keywords": [
        "fastapi",
        " client",
        " fastapi_client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "106049b820bd6b7a1ce1b888152d8454bebeb6f4597a713ab5b04bbce5c3e7a5",
                "md5": "83680df11219c57d54b01b07d6fac3bf",
                "sha256": "dc9c020472ddddffe3a869175fb15886b88eb45d8d6ea409008521ef5437ed68"
            },
            "downloads": -1,
            "filename": "fastapi_client-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83680df11219c57d54b01b07d6fac3bf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8436,
            "upload_time": "2024-06-20T04:58:00",
            "upload_time_iso_8601": "2024-06-20T04:58:00.056736Z",
            "url": "https://files.pythonhosted.org/packages/10/60/49b820bd6b7a1ce1b888152d8454bebeb6f4597a713ab5b04bbce5c3e7a5/fastapi_client-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "acc3479bd61dc4b48a1b81d4a484eab7ada012913ba2e253f75450e42d485beb",
                "md5": "aab5bab2043ac2540f8163093851b349",
                "sha256": "5868336b1d7146789b514c3a5a1d742e21b7182044aa9ebdfb70e4c5aee33070"
            },
            "downloads": -1,
            "filename": "fastapi_client-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "aab5bab2043ac2540f8163093851b349",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7991,
            "upload_time": "2024-06-20T04:58:01",
            "upload_time_iso_8601": "2024-06-20T04:58:01.604601Z",
            "url": "https://files.pythonhosted.org/packages/ac/c3/479bd61dc4b48a1b81d4a484eab7ada012913ba2e253f75450e42d485beb/fastapi_client-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-20 04:58:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LamaAni",
    "github_project": "fastapi_client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "fastapi",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        }
    ],
    "lcname": "fastapi-client"
}
        
Elapsed time: 0.23783s