[![PyPI package](https://img.shields.io/pypi/v/polyanalyst6api)](https://pypi.org/project/polyanalyst6api)
[![Downloads](https://static.pepy.tech/badge/polyanalyst6api)](https://pepy.tech/project/polyanalyst6api)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/polyanalyst6api)](https://pypi.org/project/polyanalyst6api/)
[![MIT License](https://img.shields.io/github/license/megaputer/polyanalyst6api-py)](https://github.com/Megaputer/polyanalyst6api-py/blob/master/LICENSE)
**_polyanalyst6api_ is a simple and easy to use client library for the PolyAnalyst API.**
This package provides wrappers for PolyAnalyst `Analytical Client`, `Scheduler` and `Drive`.
Using it you can execute nodes, view datasets, run tasks, download/upload files and so on.
## Installation
Python 3.6+ is required. Install and upgrade `polyanalyst6api` with these commands:
```shell
pip install polyanalyst6api
pip install --upgrade polyanalyst6api
```
## Documentation
See [API Reference](https://megaputer.github.io/polyanalyst6api-py) for the client library methods.
Refer to **PolyAnalyst User Manual** at **Application Programming Interfaces** > **Version 01** for REST API specification.
## Usage
### Authentication
From version `0.23.0` you can use the configuration file to store your credentials. By default, its location is
`C:\Users\_user_\.polyanalyst6api\config` (`~/.polyanalyst6api/config` in linux).
At a minimum, the credentials file should specify the url and credentials keys. You may also want to add a `ldap_server`
if you're logging in via LDAP. All other keys or sections except `DEFAULT` are ignored.
```ini
[DEFAULT]
url=POLYANALYST_URL
username=YOUR_USERNAME
password=YOUR_PASSWORD
ldap_server=LDAP
```
After creating the configuration file you can use `API` context manager to automatically log in to and log out
from PolyAnalyst server:
```python
with polyanalyst6api.API() as api:
...
```
Alternatively, you can pass an url, credentials and ldap_server when creating api client. In this case arguments
will be used over values from the configuration file.
```python
with polyanalyst6api.API(POLYANALIST_URL, YOUR_USERNAME, YOUR_PASSWORD) as api:
...
```
### Working with project
Instantiate project wrapper by calling with existing project ID:
```python
prj = api.project(PROJECT_UUID)
```
Set `Python` node code using parent `Parameters` node.
```python
prj.parameters('Parameters (1)').set(
'Dataset/Python',
{'Script': 'result = pandas.DataFrame([{"val": 42}])'}
)
```
Execute `Python` node and wait to complete execution
```python
prj.execute('Python', wait=True)
```
Check node results:
```python
ds = prj.dataset('Python').preview()
assert ds[0]['val'] == 42
```
Save project:
```python
prj.save()
```
### Downloading file from user home folder using PA Drive API
```python
content = api.drive.download_file('README.txt')
with open(r'C:\README.txt', mode='wb+') as local_file:
local_file.write(content)
```
See [polyanalyst6api-python/examples](https://github.com/Megaputer/polyanalyst6api-py/tree/master/examples) for more complex examples.
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Megaputer/polyanalyst6api-py/tree/master/LICENSE) file for details
Raw data
{
"_id": null,
"home_page": "https://github.com/Megaputer/polyanalyst6api-py",
"name": "testpolyanalyst6api",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "",
"keywords": "megaputer,polyanalyst,polyanalyst6api,api",
"author": "yatmanov",
"author_email": "yatmanov@megaputer.ru",
"download_url": "https://files.pythonhosted.org/packages/4c/f7/9f7b4c5509b00f4aed752ddbd7efe0e3e22caabc5ccb1a8f3d5c18ac0ffe/testpolyanalyst6api-0.26.2.tar.gz",
"platform": null,
"description": "[![PyPI package](https://img.shields.io/pypi/v/polyanalyst6api)](https://pypi.org/project/polyanalyst6api)\n[![Downloads](https://static.pepy.tech/badge/polyanalyst6api)](https://pepy.tech/project/polyanalyst6api)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/polyanalyst6api)](https://pypi.org/project/polyanalyst6api/)\n[![MIT License](https://img.shields.io/github/license/megaputer/polyanalyst6api-py)](https://github.com/Megaputer/polyanalyst6api-py/blob/master/LICENSE)\n\n**_polyanalyst6api_ is a simple and easy to use client library for the PolyAnalyst API.**\n\nThis package provides wrappers for PolyAnalyst `Analytical Client`, `Scheduler` and `Drive`.\nUsing it you can execute nodes, view datasets, run tasks, download/upload files and so on.\n\n## Installation\n\nPython 3.6+ is required. Install and upgrade `polyanalyst6api` with these commands:\n\n```shell\npip install polyanalyst6api\npip install --upgrade polyanalyst6api\n```\n\n## Documentation\n\nSee [API Reference](https://megaputer.github.io/polyanalyst6api-py) for the client library methods.\n\nRefer to **PolyAnalyst User Manual** at **Application Programming Interfaces** > **Version 01** for REST API specification.\n\n## Usage\n\n### Authentication\n\nFrom version `0.23.0` you can use the configuration file to store your credentials. By default, its location is\n`C:\\Users\\_user_\\.polyanalyst6api\\config` (`~/.polyanalyst6api/config` in linux).\n\nAt a minimum, the credentials file should specify the url and credentials keys. You may also want to add a `ldap_server`\nif you're logging in via LDAP. All other keys or sections except `DEFAULT` are ignored.\n\n```ini\n[DEFAULT]\nurl=POLYANALYST_URL\nusername=YOUR_USERNAME\npassword=YOUR_PASSWORD\nldap_server=LDAP\n```\n\nAfter creating the configuration file you can use `API` context manager to automatically log in to and log out\nfrom PolyAnalyst server:\n\n```python\nwith polyanalyst6api.API() as api:\n ...\n```\n\nAlternatively, you can pass an url, credentials and ldap_server when creating api client. In this case arguments\nwill be used over values from the configuration file.\n```python\nwith polyanalyst6api.API(POLYANALIST_URL, YOUR_USERNAME, YOUR_PASSWORD) as api:\n ...\n```\n\n### Working with project\n\nInstantiate project wrapper by calling with existing project ID:\n```python\nprj = api.project(PROJECT_UUID)\n```\n\nSet `Python` node code using parent `Parameters` node.\n```python\nprj.parameters('Parameters (1)').set(\n 'Dataset/Python',\n {'Script': 'result = pandas.DataFrame([{\"val\": 42}])'}\n)\n```\n\nExecute `Python` node and wait to complete execution\n```python\nprj.execute('Python', wait=True)\n```\n\nCheck node results:\n```python\nds = prj.dataset('Python').preview()\nassert ds[0]['val'] == 42\n```\n\nSave project:\n```python\nprj.save()\n```\n\n### Downloading file from user home folder using PA Drive API\n\n```python\ncontent = api.drive.download_file('README.txt')\nwith open(r'C:\\README.txt', mode='wb+') as local_file:\n local_file.write(content)\n```\n\nSee [polyanalyst6api-python/examples](https://github.com/Megaputer/polyanalyst6api-py/tree/master/examples) for more complex examples.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/Megaputer/polyanalyst6api-py/tree/master/LICENSE) file for details\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "polyanalyst6api is a PolyAnalyst API client for Python.",
"version": "0.26.2",
"project_urls": {
"Documentation": "https://megaputer.github.io/polyanalyst6api-py",
"Homepage": "https://github.com/Megaputer/polyanalyst6api-py",
"Repository": "https://github.com/Megaputer/polyanalyst6api-py"
},
"split_keywords": [
"megaputer",
"polyanalyst",
"polyanalyst6api",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "64d5ff43707978fbfbb758b796c04cc67af21dba1b92d240a122ced73833ea01",
"md5": "bf7442fd4441537336f8c9da7de01f09",
"sha256": "1658a902cd1fb78a9ff975ceb20f0467e2505953143114a2e00668de300b9d3b"
},
"downloads": -1,
"filename": "testpolyanalyst6api-0.26.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bf7442fd4441537336f8c9da7de01f09",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 16715,
"upload_time": "2023-07-04T09:26:03",
"upload_time_iso_8601": "2023-07-04T09:26:03.059301Z",
"url": "https://files.pythonhosted.org/packages/64/d5/ff43707978fbfbb758b796c04cc67af21dba1b92d240a122ced73833ea01/testpolyanalyst6api-0.26.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4cf79f7b4c5509b00f4aed752ddbd7efe0e3e22caabc5ccb1a8f3d5c18ac0ffe",
"md5": "8eeee4a0db125564268a9a3fc9425f38",
"sha256": "7b02f8083069bf2045592181e8f9a353251838656f3f0e62db35f911442c5475"
},
"downloads": -1,
"filename": "testpolyanalyst6api-0.26.2.tar.gz",
"has_sig": false,
"md5_digest": "8eeee4a0db125564268a9a3fc9425f38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 15638,
"upload_time": "2023-07-04T09:26:05",
"upload_time_iso_8601": "2023-07-04T09:26:05.244909Z",
"url": "https://files.pythonhosted.org/packages/4c/f7/9f7b4c5509b00f4aed752ddbd7efe0e3e22caabc5ccb1a8f3d5c18ac0ffe/testpolyanalyst6api-0.26.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-04 09:26:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Megaputer",
"github_project": "polyanalyst6api-py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "testpolyanalyst6api"
}