Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
You can install Pythonik directly from PyPI:
pip install nsa-pythonik
If you're using Poetry:
poetry add nsa-pythonik
To retrieve an asset from Iconik, use the following code:
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()
To get metadata for an asset from a specific view, use the following code:
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()
Checkout the API reference and advanced usage guide to see all you can do with Pythonik.
To publish a new version to PyPI please see the release how-to guide.
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.
First, install Poetry if you haven't already:
To create and activate a Poetry shell, which sets up an isolated virtual environment for your project:
Navigate to your project directory.
Run the following command:
poetry shell
This command will activate a virtual environment managed by Poetry. You can now run Python commands and scripts within this environment.
poetry install
To run tests using pytest, follow these steps:
Inside the Poetry shell, run the tests with the following command:
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.
For support, please contact NSA.
Details about upcoming features and enhancements will be added here.
Please see the contribution guide for information on how to contribute.
This SDK is developed and maintained by North Shore Automation developers, including Brant Goddard, Prince Duepa, Giovann Wah, and Brandon Dedolph.
License information will be available soon.
Current project status and updates will be posted here.
FAQs
Python SDK for Iconik's API
We found that nsa-pythonik demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.