Skip to main content

polyanalyst6api is a PolyAnalyst API client for Python.

Project description

PyPI package Downloads Supported Python versions MIT 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:

pip install polyanalyst6api
pip install --upgrade polyanalyst6api

Documentation

See API Reference 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.

[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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polyanalyst6api-0.25.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

polyanalyst6api-0.25.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file polyanalyst6api-0.25.1.tar.gz.

File metadata

  • Download URL: polyanalyst6api-0.25.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Windows/10

File hashes

Hashes for polyanalyst6api-0.25.1.tar.gz
Algorithm Hash digest
SHA256 58154c7a76a02fe8ac67e5ed7a761674e99dc03debeed02640e64ef2e6e8911a
MD5 505015c0a3c6e0d237ad8f4652865940
BLAKE2b-256 940d43bfa5a7ba55604603937f747c4ba9df7fb6046cc56fcdd814752188def5

See more details on using hashes here.

File details

Details for the file polyanalyst6api-0.25.1-py3-none-any.whl.

File metadata

File hashes

Hashes for polyanalyst6api-0.25.1-py3-none-any.whl
Algorithm Hash digest
SHA256 512141ea9c13a73330efefe8840cf07f2e8d1f2a398a707d356457aa2f470e16
MD5 bf99b1716799100c2859066690fb647a
BLAKE2b-256 85af03db023ef01e8c38d6079c345f5c490309b6286de1af25342a833207c852

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page