polyanalyst6api is a PolyAnalyst API client for Python.
Project description
polyanalyst6api
polyanalyst6api
is a Python library for interacting with PolyAnalyst APIs.
This package provides easy to use wrappers for PolyAnalyst Analytical Client
, Scheduler
and Drive
.
With it you can execute nodes, view datasets, run tasks, download/upload files and so on.
Installation
Python 3.6+ is required. Install, upgrade and uninstall polyanalyst6api-python
with these commands:
$ pip install polyanalyst6api
$ pip install --upgrade polyanalyst6api
$ pip uninstall polyanalyst6api
Documentation
See API Reference for the 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.
[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:
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.
with polyanalyst6api.API(POLYANALIST_URL, YOUR_USERNAME, YOUR_PASSWORD) as api:
...
Working with project
Instantiate project wrapper by calling with existing project ID:
prj = api.project(PROJECT_UUID)
Set Python
node code using parent Parameters
node.
prj.parameters('Parameters (1)').set(
'Dataset/Python',
{'Script': 'result = pandas.DataFrame([{"val": 42}])'}
)
Execute Python
node and wait to complete execution
prj.execute('Python', wait=True)
Check node results:
ds = prj.dataset('Python').preview()
assert ds[0]['val'] == 42
Save project:
prj.save()
Downloading file from user home folder using PA Drive API
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 for more complex examples.
License
This project is licensed under the MIT License - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file polyanalyst6api-0.23.0.tar.gz
.
File metadata
- Download URL: polyanalyst6api-0.23.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.6 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 234d9c6581fc46db55add2f5e57795abbebdba5cd28f30f78a08307492441817 |
|
MD5 | 0d49c9a81720f63ffccb56c155d9b26a |
|
BLAKE2b-256 | bc1c778b792067e02a21d8241f2dd9a76f9537093b333c1b8350e95e4097dc8c |
File details
Details for the file polyanalyst6api-0.23.0-py3-none-any.whl
.
File metadata
- Download URL: polyanalyst6api-0.23.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.6 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 284f55985af39c09e6fd92030a489ee69763f5022161a947dbb6fb004e96a7d4 |
|
MD5 | f8b5aceee86e8830c1c8d2dfacef5902 |
|
BLAKE2b-256 | c05c5a2e452c5c49cef68ac97d7504a815140cc0c1474aefb55321529cf97100 |