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.
Python 3.7+ is required. Install and upgrade polyanalyst6api
with these commands:
pip install polyanalyst6api
pip install --upgrade polyanalyst6api
See API Reference for the client library methods.
Refer to PolyAnalyst User Manual at Application Programming Interfaces > Version 01 for REST API specification.
Import an api client and log in to PolyAnalyst server
from polyanalyst6api import API
with API(POLYANALIST_URL, USERNAME, PASSWORD) as api:
# making a request to PolyAnalyst endpoint that require authorization
print(api.get_server_info())
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()
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.
This project is licensed under the MIT License - see the LICENSE file for details