Name | vital JSON |
Version | 2.1.1 JSON |
download | |
home_page | |
Summary | |
upload_time | 2024-02-29 10:42:30 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7,<4.0 |
license | |
keywords | |
VCS | |
bugtrack_url | |
requirements | No requirements were recorded. |
Travis-CI | No Travis. |
coveralls test coverage | No coveralls. |
# Vital Python Library [![pypi](https://img.shields.io/pypi/v/vital.svg)](https://pypi.python.org/pypi/vital) [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) The Vital Python library provides access to the Vital API from applications written in Python. ## Documentation API reference documentation is available [here](https://docs.tryvital.io/home/welcome). ## Installation Add this dependency to your project's build file: ```bash pip install vital # or poetry add vital ``` ## Usage ```python from vital.client import Vital vital_client = Vital( api_key="YOUR_API_KEY", ) lab_test = vital_client.lab_tests.get('order-id') print(lab_test) ``` ## Async Client The SDK also exports an async client. ```python from vital.client import AsyncVital import asyncio vital_client = AsyncVital( api_key="YOUR_API_KEY", ) async def get_lab_test() -> None: lab_test = vital_client.lab_tests.get('order-id') print(lab_test) asyncio.run(get_lab_test()) ``` ## Handling Errors All exceptions thrown by the SDK will sublcass [ApiError](./src/vital/core/api_error.py). ```python from vital.core import ApiError from vital import BadRequestError try: vital_client.lab_tests.get('order-id') except BadRequestError as e: # handle bad request error except APIError as e: # handle any api related error ``` ## Environments When you sign up to Vital you get access to two environments, Sandbox and Production. | Environment URLs | | | ---------------- | -------------------------- | | `production` | api.tryvital.io | | `production-eu` | api.eu.tryvital.io | | `sandbox` | api.sandbox.tryvital.io | | `sandbox-eu` | api.sandbox.eu.tryvital.io | By default, the SDK uses the `production` environment. See the snippet below for an example on how ot change the environment. ```python from vital.client import Vital from vital.environment import VitalEnvironment vital_client = Vital( api_key="YOUR_API_KEY", environment=VitalEnvironment.Sandbox ) ``` ## Timeouts By default, the client is configured to have a timeout of 60 seconds. You can customize this value at client instantiation. ```python from vital.client import Vital from vital.environment import VitalEnvironment vital_client = Vital( api_key="YOUR_API_KEY", environment=VitalEnvironment.Sandbox, timeout=15 ) ``` ## Beta status This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your pyproject.toml file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version. ## Contributing While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! On the other hand, contributions to the README are always very welcome!
{ "_id": null, "home_page": "", "name": "vital", "maintainer": "", "docs_url": null, "requires_python": ">=3.7,<4.0", "maintainer_email": "", "keywords": "", "author": "", "author_email": "", "download_url": "https://files.pythonhosted.org/packages/24/c9/837388fbae8c8be7b828d67cd3641efea7963358119cf10d44cda926b9b3/vital-2.1.1.tar.gz", "platform": null, "description": "# Vital Python Library\n\n[![pypi](https://img.shields.io/pypi/v/vital.svg)](https://pypi.python.org/pypi/vital)\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)\n\nThe Vital Python library provides access to the Vital API from applications written in Python.\n\n## Documentation\n\nAPI reference documentation is available [here](https://docs.tryvital.io/home/welcome).\n\n## Installation\n\nAdd this dependency to your project's build file:\n\n```bash\npip install vital\n# or\npoetry add vital\n```\n\n## Usage\n\n```python\nfrom vital.client import Vital\n\nvital_client = Vital(\n api_key=\"YOUR_API_KEY\",\n)\n\nlab_test = vital_client.lab_tests.get('order-id')\n\nprint(lab_test)\n```\n\n## Async Client\n\nThe SDK also exports an async client.\n\n```python\nfrom vital.client import AsyncVital\n\nimport asyncio\n\nvital_client = AsyncVital(\n api_key=\"YOUR_API_KEY\",\n)\n\nasync def get_lab_test() -> None:\n lab_test = vital_client.lab_tests.get('order-id')\n print(lab_test)\n\nasyncio.run(get_lab_test())\n```\n\n## Handling Errors\n\nAll exceptions thrown by the SDK will sublcass [ApiError](./src/vital/core/api_error.py).\n\n```python\nfrom vital.core import ApiError\nfrom vital import BadRequestError\n\ntry:\n vital_client.lab_tests.get('order-id')\nexcept BadRequestError as e:\n # handle bad request error\nexcept APIError as e:\n # handle any api related error\n```\n\n## Environments\n\nWhen you sign up to Vital you get access to two environments, Sandbox and Production.\n\n| Environment URLs | |\n| ---------------- | -------------------------- |\n| `production` | api.tryvital.io |\n| `production-eu` | api.eu.tryvital.io |\n| `sandbox` | api.sandbox.tryvital.io |\n| `sandbox-eu` | api.sandbox.eu.tryvital.io |\n\nBy default, the SDK uses the `production` environment. See the snippet below\nfor an example on how ot change the environment.\n\n```python\nfrom vital.client import Vital\nfrom vital.environment import VitalEnvironment\n\nvital_client = Vital(\n api_key=\"YOUR_API_KEY\",\n environment=VitalEnvironment.Sandbox\n)\n```\n\n## Timeouts\n\nBy default, the client is configured to have a timeout of 60 seconds.\nYou can customize this value at client instantiation.\n\n```python\nfrom vital.client import Vital\nfrom vital.environment import VitalEnvironment\n\nvital_client = Vital(\n api_key=\"YOUR_API_KEY\",\n environment=VitalEnvironment.Sandbox,\n timeout=15\n)\n```\n\n## Beta status\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your pyproject.toml file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n", "bugtrack_url": null, "license": "", "summary": "", "version": "2.1.1", "project_urls": null, "split_keywords": [], "urls": [ { "comment_text": "", "digests": { "blake2b_256": "22a9d5d02e063d8ceaee79bc7f13d78ae58c9ad1c7ba827e94a9a9617fc72d7b", "md5": "85ee6ef1575a07fef0f40e9c75a72388", "sha256": "807c16cbc5c1fe7f3b2f2bc958fde55bf1a6ffb7c0174c49a6f3eb24cbe2456b" }, "downloads": -1, "filename": "vital-2.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "85ee6ef1575a07fef0f40e9c75a72388", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 208265, "upload_time": "2024-02-29T10:42:28", "upload_time_iso_8601": "2024-02-29T10:42:28.181460Z", "url": "https://files.pythonhosted.org/packages/22/a9/d5d02e063d8ceaee79bc7f13d78ae58c9ad1c7ba827e94a9a9617fc72d7b/vital-2.1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "24c9837388fbae8c8be7b828d67cd3641efea7963358119cf10d44cda926b9b3", "md5": "36cf9ae9dcaa56a0753b41cb0e150745", "sha256": "7b7d1a8a5cc31e65c3e00a2723788d49e4bc535eb93aa3a1829d9601e6d2c4c7" }, "downloads": -1, "filename": "vital-2.1.1.tar.gz", "has_sig": false, "md5_digest": "36cf9ae9dcaa56a0753b41cb0e150745", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 66857, "upload_time": "2024-02-29T10:42:30", "upload_time_iso_8601": "2024-02-29T10:42:30.057663Z", "url": "https://files.pythonhosted.org/packages/24/c9/837388fbae8c8be7b828d67cd3641efea7963358119cf10d44cda926b9b3/vital-2.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "upload_time": "2024-02-29 10:42:30", "github": false, "gitlab": false, "bitbucket": false, "codeberg": false, "lcname": "vital" }