> [!Warning]
**This project utitilizes Mend API 1.4. While 1.4 and this project are still supported, Mend is actively moving toward a RESTful standard for APIs. All new development is encouraged to utilize [Mend API 2.0](https://docs.mend.io/bundle/mend-api-2-0/page/index.html). API 2.0 will transition more easily into API 3.0 when it is released with the Mend Unified Platform**
[![Logo](https://resources.mend.io/mend-sig/logo/mend-dark-logo-horizontal.png)](https://www.mend.io/)
[![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0)
[![CI](https://github.com/whitesource-ps/ws-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/whitesource-ps/ws-sdk/actions/workflows/ci.yml)
[![Python 3.7](https://upload.wikimedia.org/wikipedia/commons/7/76/Blue_Python_3.7%2B_Shield_Badge.svg)
[![PyPI](https://img.shields.io/pypi/v/ws-sdk?style=plastic)](https://pypi.org/project/ws-sdk/)
# [Mend Python SDK](https://github.com/whitesource-ps/ws-sdk)
SDK written in Python to simplify access to Mend resources
The SDK contains the following modules:
* **web** - Module for accessing Mend Application (reports, administration, etc...).
* **client** - UA wrapper layer (download UA, execute scan, read UA output files...).
## Supported Operating Systems
- **Linux (Bash):** CentOS, Debian, Ubuntu, RedHat
- **Windows (PowerShell):** 10, 2012, 2016
## How to install package from PyPi
1. Obtain connection details from WS Application (Home > Admin > Integration).
1. Install package from Pypi: `pip install ws-sdk` .
## How to build and install package from source (for developers)
1. Download the code: `git clone https://github.com/whitesource-ps/ws-sdk.git`.
1. Build wheel package `python setup.py bdist_wheel` .
1. Download wheel from GitHub and install : `pip install ws-sdk*.whl` .
## Execution
* WS_URL should be the URL for your environment without https:// e.g. saas.whitesourcesoftware.com.
* USER_KEY needs to be generated on the Mend UI. [Generating a user key](https://upload.wikimedia.org/wikipedia/commons/7/76/Blue_Python_3.7%2B_Shield_Badge.svg)
* ORG_TOKEN can be found under the 'Integrate' tab of your Mend UI as API Key.
```python
# Unified (can do both WSApp and WSClient)
from ws_sdk.web import WS
ws = WS(url="WS_URL", user_key="USER_KEY", token="ORG_TOKEN", ua_path="/UA/WORKING/DIR")
# Web (Mend Application)
from ws_sdk.app import WSApp
ws = WSApp(url="WS_URL", user_key="USER_KEY", token="ORG_TOKEN")
# Get alerts
all_alerts = ws.get_alerts()
# Get vulnerabilities report in XLSX format
vul_report = ws.get_vulnerability(report=True)
# Get all projects ()
project_list = ws.get_projects()
# Create user in the organization
ws.create_user(name='USER_TEST1', email="USER_TEST1@EMAIL.COM", inviter_email="INVITER@EMAIL.COM")
# Client (Mend Unified Agent)
from ws_sdk.client import WSClient
ws_client = WSClient(url="WS_URL", user_key="USER_KEY", token="ORG_TOKEN", ua_path="/UA/WORKING/DIR")
# Download latest UA jar and conf file
ws_client.download_ua()
# Execute scan into defined project token
out = ws_client.scan(scan_dir="/PATH/TO/DIR", project_token="PROJ_TOKEN", product_token="PROD_TOKEN")
# Read scan artifact's policy rejection summary
pol_rej = ws_client.get_policy_rejection_summary()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/whitesource-ps/ws-sdk",
"name": "ws-sdk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "WhiteSource Professional Services",
"author_email": "ps@whitesourcesoftware.com",
"download_url": "",
"platform": null,
"description": "> [!Warning] \n**This project utitilizes Mend API 1.4. While 1.4 and this project are still supported, Mend is actively moving toward a RESTful standard for APIs. All new development is encouraged to utilize [Mend API 2.0](https://docs.mend.io/bundle/mend-api-2-0/page/index.html). API 2.0 will transition more easily into API 3.0 when it is released with the Mend Unified Platform**\n\n\n[![Logo](https://resources.mend.io/mend-sig/logo/mend-dark-logo-horizontal.png)](https://www.mend.io/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0)\n[![CI](https://github.com/whitesource-ps/ws-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/whitesource-ps/ws-sdk/actions/workflows/ci.yml)\n[![Python 3.7](https://upload.wikimedia.org/wikipedia/commons/7/76/Blue_Python_3.7%2B_Shield_Badge.svg)\n[![PyPI](https://img.shields.io/pypi/v/ws-sdk?style=plastic)](https://pypi.org/project/ws-sdk/)\n\n# [Mend Python SDK](https://github.com/whitesource-ps/ws-sdk)\nSDK written in Python to simplify access to Mend resources\n\nThe SDK contains the following modules:\n* **web** - Module for accessing Mend Application (reports, administration, etc...).\n* **client** - UA wrapper layer (download UA, execute scan, read UA output files...). \n\n## Supported Operating Systems\n- **Linux (Bash):**\tCentOS, Debian, Ubuntu, RedHat\n- **Windows (PowerShell):**\t10, 2012, 2016\n\n## How to install package from PyPi\n1. Obtain connection details from WS Application (Home > Admin > Integration).\n1. Install package from Pypi: `pip install ws-sdk` .\n\n## How to build and install package from source (for developers)\n1. Download the code: `git clone https://github.com/whitesource-ps/ws-sdk.git`.\n1. Build wheel package `python setup.py bdist_wheel` .\n1. Download wheel from GitHub and install : `pip install ws-sdk*.whl` .\n\n\n## Execution\n\n* WS_URL should be the URL for your environment without https:// e.g. saas.whitesourcesoftware.com.\n* USER_KEY needs to be generated on the Mend UI. [Generating a user key](https://upload.wikimedia.org/wikipedia/commons/7/76/Blue_Python_3.7%2B_Shield_Badge.svg)\n* ORG_TOKEN can be found under the 'Integrate' tab of your Mend UI as API Key.\n\n```python\n# Unified (can do both WSApp and WSClient)\nfrom ws_sdk.web import WS\nws = WS(url=\"WS_URL\", user_key=\"USER_KEY\", token=\"ORG_TOKEN\", ua_path=\"/UA/WORKING/DIR\")\n\n# Web (Mend Application)\nfrom ws_sdk.app import WSApp\nws = WSApp(url=\"WS_URL\", user_key=\"USER_KEY\", token=\"ORG_TOKEN\")\n# Get alerts \nall_alerts = ws.get_alerts()\n# Get vulnerabilities report in XLSX format\nvul_report = ws.get_vulnerability(report=True)\n# Get all projects ()\nproject_list = ws.get_projects()\n# Create user in the organization\nws.create_user(name='USER_TEST1', email=\"USER_TEST1@EMAIL.COM\", inviter_email=\"INVITER@EMAIL.COM\")\n\n# Client (Mend Unified Agent)\nfrom ws_sdk.client import WSClient\n\nws_client = WSClient(url=\"WS_URL\", user_key=\"USER_KEY\", token=\"ORG_TOKEN\", ua_path=\"/UA/WORKING/DIR\")\n# Download latest UA jar and conf file\nws_client.download_ua()\n# Execute scan into defined project token\nout = ws_client.scan(scan_dir=\"/PATH/TO/DIR\", project_token=\"PROJ_TOKEN\", product_token=\"PROD_TOKEN\")\n# Read scan artifact's policy rejection summary \npol_rej = ws_client.get_policy_rejection_summary()\n```\n\n\n",
"bugtrack_url": null,
"license": "LICENSE",
"summary": "WS Python SDK",
"version": "23.12.2",
"project_urls": {
"Homepage": "https://github.com/whitesource-ps/ws-sdk"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b96f89c98544879743423ac9a629b5d85282de3be8cc1cf91e4e22d2d87d9e1b",
"md5": "f49fea78f84aacf93b7d3d2f870a05d1",
"sha256": "cc95032b75cdfddc0b811156371c6add6195077c017321efcd8a702ad0ad3961"
},
"downloads": -1,
"filename": "ws_sdk-23.12.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f49fea78f84aacf93b7d3d2f870a05d1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 49388,
"upload_time": "2023-12-21T19:26:23",
"upload_time_iso_8601": "2023-12-21T19:26:23.125041Z",
"url": "https://files.pythonhosted.org/packages/b9/6f/89c98544879743423ac9a629b5d85282de3be8cc1cf91e4e22d2d87d9e1b/ws_sdk-23.12.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-21 19:26:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "whitesource-ps",
"github_project": "ws-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "ws-sdk"
}