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

dev_nectarpy-0.0.22.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

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

dev_nectarpy-0.0.22-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file dev_nectarpy-0.0.22.tar.gz.

File metadata

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

File hashes

Hashes for dev_nectarpy-0.0.22.tar.gz
Algorithm Hash digest
SHA256 e57f5d85c364d5c8f9267a690f104961af843efdcfdb62f56f76984cf050883e
MD5 65835937c9dc83cb5be8da162196d158
BLAKE2b-256 d9d3e0f702a3044b8460a84e5ed11cf34c0bf61310081f0442fff7e9fe089625

See more details on using hashes here.

File details

Details for the file dev_nectarpy-0.0.22-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dev_nectarpy-0.0.22-py3-none-any.whl
Algorithm Hash digest
SHA256 9692edb159fbd28bc899b2ba010699b04b8b7875028b56de064d1144627f15dc
MD5 9e0616306e4244e8bc3516064235802b
BLAKE2b-256 2bdcd69e1516c0fa1fc9fca06f8f0e02dcdabf18830e07e8b3c03670f2503c09

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