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,
    price=123,
)
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

Step 1: Create a .env file

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

Step 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.11.0.tar.gz (29.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: nectarpy-0.11.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for nectarpy-0.11.0.tar.gz
Algorithm Hash digest
SHA256 2e79feed5730ed5abf38e94fb2ab2ac6d9ddae4e004a370c4848efd71615a662
MD5 c54261afb96d4277ac7611757f4989b7
BLAKE2b-256 1f4c65bf7f030f29c2af773dbc3d5b468a5ec211b2418c657c1ffddba7390fd3

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