# Pythonik
Pythonik is a comprehensive Python SDK designed for seamless interaction with
the Iconik API. It offers a user-friendly interface to access various
functionalities of Iconik, making it easier for developers to integrate and
manage Iconik assets and metadata within their applications.
## Features
- Easy-to-use methods for accessing Iconik assets and metadata.
- Robust handling of API authentication and requests.
- Configurable timeout settings for API interactions.
## Installation
You can install Pythonik directly from PyPI:
```bash
pip install nsa-pythonik
```
If you're using Poetry:
```bash
poetry add nsa-pythonik
```
## Usage
### Get an Asset from Iconik
To retrieve an asset from Iconik, use the following code:
```python
from pythonik.client import PythonikClient
from pythonik.models.assets.assets import Asset
from pythonik.models.base import Response
app_id = secrets.get_secret("app_id")
auth_token = secrets.get_secret("auth_token")
asset_id = secrets.get_secret("asset_id")
client: PythonikClient = PythonikClient(app_id=app_id, auth_token=auth_token, timeout=10)
res: Response = client.assets().get(asset_id)
data: Asset = res.data
data_as_dict = data.model_dump()
data_as_json = data.model_dump_json()
```
### Get Metadata from a View
To get metadata for an asset from a specific view, use the following code:
```python
from pythonik.client import PythonikClient
from pythonik.models.assets.metadata import ViewMetadata
from pythonik.models.base import Response
app_id = secrets.get_secret("app_id")
auth_token = secrets.get_secret("auth_token")
asset_id = 'a31sd2asdf123jasdfq134'
view_id = 'a12sl34s56asdf123jhas2'
client: PythonikClient = PythonikClient(app_id=app_id, auth_token=auth_token, timeout=5)
default_model = ViewMetadata()
# intercept_404 intercepts 404 errors if no metadata is found in view and returns a ViewMetadata model you provide so you can handle the error gracefully
res: Response = client.metadata().get_asset_metadata(asset_id, view_id, intercept_404=default_model)
data: ViewMetadata = res.data
data_as_dict = data.model_dump()
data_as_json = data.model_dump_json()
```
### Connecting to Different Iconik Environments
By default, Pythonik connects to the standard Iconik environment (`https://app.iconik.io`). To connect to a different Iconik environment, you can specify the base URL when initializing the client:
```python
from pythonik.client import PythonikClient
client = PythonikClient(
app_id=app_id,
auth_token=auth_token,
timeout=10,
base_url="https://your-custom-iconik-instance.com"
)
```
This is useful when working with:
- AWS Iconik deployments
- Custom Iconik deployments (assuming this is possible)
Checkout the [API reference](./docs/API_REFERENCE.md) and [advanced usage guide](./docs/ADVANCED_USAGE.md) to see all you can do with Pythonik.
## Publishing to PyPI (for maintainers)
To publish a new version to PyPI please see the [release how-to guide](./docs/RELEASE_HOW_TO.md).
## Using Poetry
This project uses Poetry for dependency management and packaging. Below are instructions on how to work with Poetry, create a Poetry shell, and run tests using pytest.
### Setting Up Poetry
First, install Poetry if you haven't already:
### Creating a Poetry Shell
To create and activate a Poetry shell, which sets up an isolated virtual environment for your project:
1. Navigate to your project directory.
2. Run the following command:
```sh
poetry shell
```
This command will activate a virtual environment managed by Poetry. You can now run Python commands and scripts within this environment.
### Install all dependencies including pytest
```sh
poetry install
```
### Running Tests with pytest
To run tests using pytest, follow these steps:
1. Inside the Poetry shell, run the tests with the following command:
```sh
pytest
```
This will discover and execute all the tests in your project.
---
By following these steps, you can efficiently manage dependencies, create a virtual environment, and run tests in your Python project using Poetry.
## Support
For support, please contact NSA.
## Roadmap
Details about upcoming features and enhancements will be added here.
## Contributing
Please see the [contribution guide](./CONTRIBUTING.md) for information on how to contribute.
## Authors and Acknowledgment
This SDK is developed and maintained by North Shore Automation developers,
including Brant Goddard, Prince Duepa, Giovann Wah, and Brandon Dedolph.
## Contributors
## License
License information will be available soon.
## Project Status
Current project status and updates will be posted here.
Raw data
{
"_id": null,
"home_page": "https://github.com/NorthShoreAutomation/pythonik",
"name": "nsa-pythonik",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "iconik, api, sdk, media",
"author": "brant",
"author_email": "brant@northshoreautomation.com",
"download_url": "https://files.pythonhosted.org/packages/d8/a0/dd163970503787c2b5fd8d1b2931c93fd7c12c459dd09af2d0c883e9abca/nsa_pythonik-1.5.0.tar.gz",
"platform": null,
"description": "# Pythonik\n\nPythonik is a comprehensive Python SDK designed for seamless interaction with\nthe Iconik API. It offers a user-friendly interface to access various\nfunctionalities of Iconik, making it easier for developers to integrate and\nmanage Iconik assets and metadata within their applications.\n\n## Features\n\n- Easy-to-use methods for accessing Iconik assets and metadata.\n- Robust handling of API authentication and requests.\n- Configurable timeout settings for API interactions.\n\n## Installation\n\nYou can install Pythonik directly from PyPI:\n\n```bash\npip install nsa-pythonik\n```\n\nIf you're using Poetry:\n```bash\npoetry add nsa-pythonik\n```\n\n## Usage\n\n### Get an Asset from Iconik\n\nTo retrieve an asset from Iconik, use the following code:\n\n```python\nfrom pythonik.client import PythonikClient\nfrom pythonik.models.assets.assets import Asset\nfrom pythonik.models.base import Response\n\napp_id = secrets.get_secret(\"app_id\")\nauth_token = secrets.get_secret(\"auth_token\")\nasset_id = secrets.get_secret(\"asset_id\")\n\nclient: PythonikClient = PythonikClient(app_id=app_id, auth_token=auth_token, timeout=10)\n\n\nres: Response = client.assets().get(asset_id)\ndata: Asset = res.data\ndata_as_dict = data.model_dump()\ndata_as_json = data.model_dump_json()\n\n```\n\n### Get Metadata from a View\n\nTo get metadata for an asset from a specific view, use the following code:\n\n```python\nfrom pythonik.client import PythonikClient\nfrom pythonik.models.assets.metadata import ViewMetadata\nfrom pythonik.models.base import Response\n\napp_id = secrets.get_secret(\"app_id\")\nauth_token = secrets.get_secret(\"auth_token\")\n\nasset_id = 'a31sd2asdf123jasdfq134'\nview_id = 'a12sl34s56asdf123jhas2'\n\nclient: PythonikClient = PythonikClient(app_id=app_id, auth_token=auth_token, timeout=5)\n\ndefault_model = ViewMetadata()\n# intercept_404 intercepts 404 errors if no metadata is found in view and returns a ViewMetadata model you provide so you can handle the error gracefully\nres: Response = client.metadata().get_asset_metadata(asset_id, view_id, intercept_404=default_model)\ndata: ViewMetadata = res.data\ndata_as_dict = data.model_dump()\ndata_as_json = data.model_dump_json()\n```\n\n### Connecting to Different Iconik Environments\n\nBy default, Pythonik connects to the standard Iconik environment (`https://app.iconik.io`). To connect to a different Iconik environment, you can specify the base URL when initializing the client:\n\n```python\nfrom pythonik.client import PythonikClient\n\nclient = PythonikClient(\n app_id=app_id,\n auth_token=auth_token,\n timeout=10,\n base_url=\"https://your-custom-iconik-instance.com\"\n)\n```\n\nThis is useful when working with:\n- AWS Iconik deployments\n- Custom Iconik deployments (assuming this is possible)\n\nCheckout the [API reference](./docs/API_REFERENCE.md) and [advanced usage guide](./docs/ADVANCED_USAGE.md) to see all you can do with Pythonik.\n\n## Publishing to PyPI (for maintainers) \n\nTo publish a new version to PyPI please see the [release how-to guide](./docs/RELEASE_HOW_TO.md).\n\n\n## Using Poetry\n\nThis project uses Poetry for dependency management and packaging. Below are instructions on how to work with Poetry, create a Poetry shell, and run tests using pytest.\n\n### Setting Up Poetry\n\nFirst, install Poetry if you haven't already:\n\n### Creating a Poetry Shell\n\nTo create and activate a Poetry shell, which sets up an isolated virtual environment for your project:\n\n1. Navigate to your project directory.\n2. Run the following command:\n\n ```sh\n poetry shell\n ```\n\nThis command will activate a virtual environment managed by Poetry. You can now run Python commands and scripts within this environment.\n\n### Install all dependencies including pytest\n\n```sh\n poetry install\n```\n\n### Running Tests with pytest\n\nTo run tests using pytest, follow these steps:\n\n1. Inside the Poetry shell, run the tests with the following command:\n\n ```sh\n pytest\n ```\n\nThis will discover and execute all the tests in your project.\n\n---\n\nBy following these steps, you can efficiently manage dependencies, create a virtual environment, and run tests in your Python project using Poetry.\n\n## Support\n\nFor support, please contact NSA.\n\n## Roadmap\n\nDetails about upcoming features and enhancements will be added here.\n\n## Contributing\n\nPlease see the [contribution guide](./CONTRIBUTING.md) for information on how to contribute.\n\n## Authors and Acknowledgment\n\nThis SDK is developed and maintained by North Shore Automation developers,\nincluding Brant Goddard, Prince Duepa, Giovann Wah, and Brandon Dedolph.\n\n## Contributors\n\n## License\n\nLicense information will be available soon.\n\n## Project Status\n\nCurrent project status and updates will be posted here.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for Iconik's API",
"version": "1.5.0",
"project_urls": {
"Homepage": "https://github.com/NorthShoreAutomation/pythonik",
"Repository": "https://github.com/NorthShoreAutomation/pythonik"
},
"split_keywords": [
"iconik",
" api",
" sdk",
" media"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0347c3c5d7f24105eac54ae531a06178ad71b2b0e33c7b8f09a8cba5eb5185e8",
"md5": "0687298fb4ef83b778fb50ae05d4e4e3",
"sha256": "be4bf1b9140f3aed665d94d6f61f5873d2048f974f5e981877dddc4c5234f038"
},
"downloads": -1,
"filename": "nsa_pythonik-1.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0687298fb4ef83b778fb50ae05d4e4e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 42126,
"upload_time": "2024-12-24T17:45:39",
"upload_time_iso_8601": "2024-12-24T17:45:39.617985Z",
"url": "https://files.pythonhosted.org/packages/03/47/c3c5d7f24105eac54ae531a06178ad71b2b0e33c7b8f09a8cba5eb5185e8/nsa_pythonik-1.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d8a0dd163970503787c2b5fd8d1b2931c93fd7c12c459dd09af2d0c883e9abca",
"md5": "adf26992234a01d793aeab8d6ea3bdda",
"sha256": "4316c74dec04337db448c563b0244f4d6610b4fb1653d29c371c2a6df94a75fe"
},
"downloads": -1,
"filename": "nsa_pythonik-1.5.0.tar.gz",
"has_sig": false,
"md5_digest": "adf26992234a01d793aeab8d6ea3bdda",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 29538,
"upload_time": "2024-12-24T17:45:41",
"upload_time_iso_8601": "2024-12-24T17:45:41.867716Z",
"url": "https://files.pythonhosted.org/packages/d8/a0/dd163970503787c2b5fd8d1b2931c93fd7c12c459dd09af2d0c883e9abca/nsa_pythonik-1.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-24 17:45:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NorthShoreAutomation",
"github_project": "pythonik",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nsa-pythonik"
}