Skip to main content

A Python API module designed to run queries on Nectar

Project description

PYTHON NECTAR MODULE

This is a Python API module designed to run queries on Nectar, add bucket information, and set policies.

Install

pip3 install nectarpy

Python Example

from nectarpy import Nectar
API_SECRET = "<api-secret>"
nectar = Nectar(API_SECRET)
policy_id = nectar.add_policy(
    allowed_categories=["*"],
    allowed_addresses=[],
    allowed_columns=["*"],
    valid_days=1000,
    usd_price=0.0123,
)
TEE_DATA_URL = "https://<ip-address>:5229/"
bucket_id = nectar.add_bucket(
    policy_ids=[policy_id],
    data_format="std1",
    node_address=TEE_DATA_URL,
)
result = nectar.train_model(
    type="linear-regression",
    parameters='{"xcols":["heart_rate","age"],"ycol":"height"}',
    filters='[{"column":"smoking","filter":"=","value":false}]',
    use_allowlists=[False],
    access_indexes=[0],
    bucket_ids=[bucket_id],
    policy_indexes=[0],
)
print(result)

Integration Tests

1: Create a .env file

API_SECRET=0x123...
NETWORK_MODE=<localhost | moonbase | moonbeam>
TEE_DATA_URL=https://<ip-address>:5229/

2: Run

python3 tests.py

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

nectarpy-0.14.3.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nectarpy-0.14.3-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file nectarpy-0.14.3.tar.gz.

File metadata

  • Download URL: nectarpy-0.14.3.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nectarpy-0.14.3.tar.gz
Algorithm Hash digest
SHA256 d969638a0d89e41f56ff1558b32a14649c2c6617e58f3a1f0941cc38e8c20d28
MD5 15b2495e430dbc2775e77a49c70825ab
BLAKE2b-256 f2063b28fc0c75111ce51720dc6eed33466e1a9886371689680ae1949ac5099f

See more details on using hashes here.

File details

Details for the file nectarpy-0.14.3-py3-none-any.whl.

File metadata

  • Download URL: nectarpy-0.14.3-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nectarpy-0.14.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19a739c1e335b78aaf3bb77b430304799969587e4f58ec5e454ebe3831a72545
MD5 384658fe993c148f319ee117cb17e466
BLAKE2b-256 db4c853dfc0f7c34690e449a5803aaf0d12eb6085b486fcbc785834e47eab84e

See more details on using hashes here.

Supported by

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