Name | vital JSON |
Version |
2.1.213
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2025-02-27 17:10:00 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4.0,>=3.8 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Vital Python Library
[](https://pypi.python.org/pypi/vital)
[](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!
Raw data
{
"_id": null,
"home_page": null,
"name": "vital",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9f/3a/69060ce545cf01f885eb7d9eef5cbb35ca2e043a3f524b74917603ab829e/vital-2.1.213.tar.gz",
"platform": null,
"description": "# Vital Python Library\n\n[](https://pypi.python.org/pypi/vital)\n[](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": null,
"summary": null,
"version": "2.1.213",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1a882947ddcc8c3027dfa41c4fc71d796377c0d8a4bf8f5745141595102568f0",
"md5": "4715fe836d2a1c3ece07ac9ed2c78ecd",
"sha256": "a30ba9d10572b1c50c34742070f4956a2933643b053bed401e715b85ee261ded"
},
"downloads": -1,
"filename": "vital-2.1.213-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4715fe836d2a1c3ece07ac9ed2c78ecd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 416474,
"upload_time": "2025-02-27T17:09:59",
"upload_time_iso_8601": "2025-02-27T17:09:59.030751Z",
"url": "https://files.pythonhosted.org/packages/1a/88/2947ddcc8c3027dfa41c4fc71d796377c0d8a4bf8f5745141595102568f0/vital-2.1.213-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f3a69060ce545cf01f885eb7d9eef5cbb35ca2e043a3f524b74917603ab829e",
"md5": "504d4661468d8bb36aee21673ab462ed",
"sha256": "5caaf500fcbd2d7cc8e420b25fcbbaf5db3aae3f99260c8ff583fd516973c994"
},
"downloads": -1,
"filename": "vital-2.1.213.tar.gz",
"has_sig": false,
"md5_digest": "504d4661468d8bb36aee21673ab462ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 142978,
"upload_time": "2025-02-27T17:10:00",
"upload_time_iso_8601": "2025-02-27T17:10:00.805152Z",
"url": "https://files.pythonhosted.org/packages/9f/3a/69060ce545cf01f885eb7d9eef5cbb35ca2e043a3f524b74917603ab829e/vital-2.1.213.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-27 17:10:00",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "vital"
}